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 +
If you rather prefer to deliver an error page from a static file, you can override vcl_error() with a bit of C-code:
sub vcl_error {
set obj.http.Content-Type = "text/html; charset=utf-8";
C{
#include
#include
FILE * pFile;
char content [100];
char page [10240];
char fname [50];
page[0] = '\0';
sprintf(fname, "/var/www/error/index.html", VRT_r_obj_status(sp));
pFile = fopen(fname, "r");
while (fgets(content, 100, pFile)) {
strcat(page, content);
}
fclose(pFile);
VRT_synth_page(sp, 0, page, "", vrt_magic_string_end);
return (deliver);
}C
}