Maintenance message pages
Brice Figureau
brice+nginx at daysofwonder.com
Mon Aug 6 19:42:39 MSD 2007
Hi,
On Mon, 2007-08-06 at 17:22 +0200, Alexander Staubo wrote:
> We're using Nginx with Mongrel + Rails. Whenever we take the system
> down for upgrades or maintenance, we take down all Mongrel processes
> and set a flag using a file. The Nginx config looks like this:
>
> if (-f $document_root/.maintenance) {
> rewrite ^(.*)$ /maintenance.html last;
> break;
> }
>
> There are two problems with this approach:
>
> (1) Users who are POSTing forms at the moment when we put up this
> message will get a 405 ("Method not allowed") error.
>
> (2) AJAX requests that occur at the same time will get the maintenance
> page in its entirety, which is not approriate for inline embeds.
>
[snipped]
I think you should return an HTTP code 503.
This mught fix your two points (at least the first one) and also forbid
any robot (like googlebot or such) to index your maintenance page in
place of the regular page usually found at this place...
What I'm usually doing is:
if (-f $document_root/.maintenance) {
return 503;
}
error_page 503 /maintenance.html;
or a variation of the above configuration.
I hope this will help,
--
Brice Figureau <brice+nginx at daysofwonder.com>
More information about the nginx
mailing list