Putting the site in maintenance mode?

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Apr 30 09:14:42 CEST 2009


In message <60B9E91D-8D9D-4056-8CC9-1240D7F38B6F at gyldendal.dk>, =?ISO-8859-1?Q?
Lars_J=F8rgensen?= writes:

>Is there any way to put the whole site in maintenance mode in a nice  =
>way? Like telling varnish "don't serve any content, just the error  =
>page"?

Varnish allows you to have multiple VCL programs loaded, but only one
of them is active at any one time.

What you could do, is therefore to have VCL for maintenance, something
along the lines of;

	sub vcl_recv {
		error 503
	}

	sub vcl_error {
		...
	}

Load it with the cli commands "vcl.load maint <filename>"

When you want to go into maintenance mode, you switch to that VCL,
using "vcl.use maint"

when you want to get back to production, you switch back to your
normal VCL with "vcl.use boot"

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-misc mailing list