Reputation: 178
When you need a maintenance site in your Varnish, the default way is to serve it via sub vcl_error() by calling error 503
.
The problem here is, when you need js/css/images in your maintenance site and they are hosted on the same URL, as all of this files will end up in a 503 too.
Is there a way to exclude specific files or files by file extension? I tried several ways, e.g. placing an if() statement around the error 503 and just enter it if file extension is not png,jpg,js,css. But it leads to a timeout.
Most time i've been reading, that placing files on e.g. Cloudflare or use base64 encoding for images and inline css/js if needed.
Are these the only ways?
Upvotes: 0
Views: 389
Reputation: 148
They are right, base64 encoded images and inline css, js, etc... is safest bet.
and on and on.
BTW, you don't have to put html file inside vcl, you could use this statement:
synthetic std.fileread("/etc/varnish/error.html");
and all you need is single inline html from design department.
Upvotes: 1
Reputation: 178
Ok, i've found a workaround that works for me now.
In the HTML code, that represents the maintenance site, i've used URLs including the backend port. So the requests won't hit the Varnish itself but the Apache server.
Upvotes: 0