Home > Net >  What is the correct HTTP status code to send when selected website pages are down for maintenance?
What is the correct HTTP status code to send when selected website pages are down for maintenance?

Time:12-24

Scenario: A website has one or more articles that need to be updated. The article needs be pulled offline before the editing is undertaken, an audit is completed, the article is back online. Note: The remainder of said website is online and functioning as intended.

What HTTP status code should be served to requests for the URL that is temporarily offline?

  • 503 Service Unavailable implies a server configuration issue, but is the closest I've been able to justify.
  • 410 Gone is not entirely appropriate since the content will return.
  • 307 Temporary Redirect could perhaps be used, but I'd prefer to not redirect to a single 'be right back' page.
  • 451 Unavailable For Legal Reasons could also be used where a legal mandate requires an edit / audit, but not appropriate if content is not affected by legal actions.

CodePudding user response:

In your scenario, you want the URL to be temporarily unvailable until the audit is completed -- which should not take too long -- so not to convey an error, but a temporary redirection in the 300-range.

There's another server-side HTTP status code, which fits the purpose: 302 Found denoting to the client, that the URL is correct for future requests, just temporarily not available.

The complete description from here:

This response code means that the URI of requested resource has been changed temporarily. Further changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests.

CodePudding user response:

503 Service Unavailable The server cannot handle the request (because it is overloaded or down for maintenance). Generally, this is a temporary state.

Reference https://stackoverflow.com/a/2786603/17755263

  • Related