Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

User-friendly error pages from Varnish

Tags:

varnish

plone

We are using Varnish at the front of Plone. In the case Plone goes down or serves an internal error we'd like to show a user-friendly static HTML page which some CSS styling + images. ("The server is being updated page")

How to configure Varnish to do this?

like image 315
Mikko Ohtamaa Avatar asked May 11 '11 08:05

Mikko Ohtamaa


1 Answers

Another simple way to do it is using the std vmod that comes with varnish. This is my preferred way to do it because I like having the error messages outside the configuration in case you want to have multiple responses for different status codes.

import std;

sub vcl_error {
    set obj.http.Content-Type = "text/html; charset=utf-8";
    synthetic std.fileread("/path/to/file.html");

    return (deliver);
}
like image 89
bwight Avatar answered Sep 19 '22 15:09

bwight