Commit 836d8559 authored by Per Buer's avatar Per Buer

Remove references to vcl_error.

parent dd54b29a
......@@ -251,11 +251,11 @@ VCL::
# call some detection engine
if (req.http.X-UA-Device ~ "^mobile" || req.http.X-UA-device ~ "^tablet") {
error 750 "Moved Temporarily";
return(synth(750, "Moved Temporarily"));
}
}
sub vcl_error {
sub vcl_synth {
if (obj.status == 750) {
set obj.http.Location = "http://m.example.com" + req.url;
set obj.status = 302;
......
......@@ -99,14 +99,14 @@ You can also add bans to Varnish via HTTP. Doing so requires a bit of VCL::
if (req.method == "BAN") {
# Same ACL check as above:
if (!client.ip ~ purge) {
error 405 "Not allowed.";
return(synth(403, "Not allowed."));
}
ban("req.http.host == " + req.http.host +
"&& req.url == " + req.url);
# Throw a synthetic page so the
# request won't go to the backend.
return(synth(200m"Ban added"));
return(synth(200, "Ban added"));
}
}
......@@ -130,7 +130,7 @@ You can use the following template to write ban lurker friendly bans::
sub vcl_recv {
if (req.method == "PURGE") {
if (client.ip !~ purge) {
error 401 "Not allowed";
return(synth(403, "Not allowed"));
}
ban("obj.http.x-url ~ " + req.url); # Assumes req.url is a regex. This might be a bit too simple
}
......
......@@ -22,8 +22,9 @@ yourself doing frequently.
The vcl_recv subroutine may terminate with calling ``return()`` on one
of the following keywords:
error
Return the specified error code to the client and abandon the request.
synth
Return a synthetic object with the specified error code to the
client and abandon the request.
pass
Switch to pass mode. Control will eventually pass to vcl_pass.
......@@ -51,7 +52,7 @@ shuffling bytes back and forth.
The vcl_pipe subroutine may terminate with calling return() with one
of the following keywords:
error code [reason]
synth(error code, reason)
Return the specified error code to the client and abandon the request.
pipe
......@@ -68,7 +69,7 @@ submitted over the same client connection are handled normally.
The vcl_pass subroutine may terminate with calling return() with one
of the following keywords:
error [reason]
synth(error code, reason)
Return the specified error code to the client and abandon the request.
pass
......@@ -157,13 +158,6 @@ keywords:
error.
.. XXX
.. vcl_error
.. ~~~~~~~~~
.. Not sure if we're going to keep this around.
vcl_backend_fetch
~~~~~~~~~~~~~~~~~
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment