For SEO purposes, we would like to change the HTTP status code returned whenever the backend machine behind nginx goes down for some reason.
We would like to change this to "503 Service Unavailable". As well as provide a Retry-After header to indicated to Google / Bing that the request should be retried in X number of seconds.
Is this possible via nginx?
I am not talking about a custom error page, but rather the status code returned in the header.
Name your error page
/500.html
and:Should work as well and seems a bit simpler to me. Note: it doesn't support the Header either.
I think you will have to set up a specific error page, however you can achieve what you're looking for if you do. Try this:
If you work it this way you should be able to return the 503 (that's the
=503
part of theerror_page
directive) and retry-after headers with the benefit that your visitors will receive a nicely formatted "oops, we're currently experiencing problems, try again in a few minutes" page rather than a blank "503 you don't really know what this means" page. :)