Serving a maintenance page with varnish

Yesterday during the SOPA Blackout, this website was on strike. The
billions of readers of this blog had a static page explaining why this
website was offline instead of the normal content. As a good nerd, I
turned this operation into a technological one and instead of serving a
static html with nginx, I decided to usevarnish. Yes, varnish. I never wrote
anything about the absolutely amazing architecture of this blog but
basically, static files are generated fromRestructuredText, served bynginx and cached by varnish. Let’s get back to the
point. I wanted varnish to serve a static page with a 503 status code
(for SEO purpose). It took a bit of VCL knowledge and here is how to do
it:

The trick here is the `synthetic` keyword which is described in the
varnish documentation like this:
> The synthetic keyword is used to produce a synthetic response body in
> `vcl_error`. It takes a single string as argument.
Now that you have a cool VCL for your maintenance page, you can load
this vcl in varnish like this:
``` bash
varnishadm -T 127.0.0.1:6082 -S /etc/varnish/secret "vcl.load maintenance /etc/varnish/maintenance.vcl"

and to replace the original rules by those described in maintenance.vcl