When your public-facing application has a longer downtime for server maintenance or long migrations, it's nice to setup a maintenance page to inform your users.
When delivering the maintenance page, be very careful to send the correct HTTP status code. Sending the wrong status code might get you kicked out of Google, or undo years of SEO work.
Here are some ways to shoot yourself in the foot durign maintenance:
/maintenance
, that /maintenance
will be the only path left in the Google index. Also browsers will cache the redirect forever.The best HTTP status code for your maintenance page is "503 Service Unavailable":
The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.
If you absolutely need to implement your maintenace page as a redirect to /maintenance
(discouraged), make sure to use 302 Found
to signal a temporary redirect.
If you want to be a super cool HTTP citizen you might also send:
Retry-After: 3600
This signals agents to retry after one hour.