Varnish error page when all backends are gone?
Rafał Radecki
radecki.rafal at gmail.com
Tue Mar 26 08:45:55 CET 2013
We are using in vcl_error:
sub vcl_error {
if (obj.status == 700) {
set obj.http.Location = obj.response;
set obj.status = 301;
set obj.response = "Moved Permanently";
} else if ( obj.status >= 500 && obj.status <= 505) {
set obj.http.Content-Type = "text/html; charset=utf-8";
synthetic
std.fileread("/etc/varnish/error_pages/503/index.html");
} else if (obj.status == 403 || obj.status == 404 ||
obj.status == 400) {
set obj.http.Location = "http://" + req.http.host +
"/no-route/";
set obj.status = 301;
}
return (deliver);
}
But it does not work as expected. Any ideas why?
Best regards,
Rafal.
2013/3/24 Mattias Geniar <mattias at nucleus.be>:
>>Is there a way to return a custom "error" page when all backends are
>>down? Or should I configure a local (on the same server as varnish)
>>instance od web server with a static page and use it in case of
>>problems? Hot to achieve that in VCL?
>
> Hi Rafal,
>
>
> Check out the use cases for the vcl_error() routine, that can output a
> synthetic{} response that contains flat HTML for a "maintenance" or status
> page. When all backends fail, the vcl_error() routine will be used.
>
> Regards,
> Mattias
>
More information about the varnish-misc
mailing list