Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP status: Use 503 Service Unavailable #19

Open
cylkee opened this issue Mar 17, 2015 · 14 comments
Open

HTTP status: Use 503 Service Unavailable #19

cylkee opened this issue Mar 17, 2015 · 14 comments
Assignees

Comments

@cylkee
Copy link

cylkee commented Mar 17, 2015

Hi,

For anonymous visitors, should not Maintenance Mode throw an HTTP status of 503 Service Unavailable? I'm thinking for search engines in particular so they know not to try to reindex a maintenance page for every URL in one's site as currently it appears to send 200 OK.

Thanks!

@michael-e
Copy link
Member

Yes, it should, probably. But for perfection you might also want a (customizable) Retry-After header.

You can do that with the HTTP Response Header Mappings extension. In the config file you could set:

'503' => 'HTTP/1.1 503 Service Unavailable',
'ra1h' => 'Retry-After: 3600',
'ra1d' => 'Retry-After: 86400',
'ra1w' => 'Retry-After: 604800',

then add the needed page types (e.g. 503 and ra1d) to your maintenance page.

@nitriques
Copy link
Member

@michael-e I think this extension should do it.

@michael-e
Copy link
Member

Yep.

Solution 1

It might at least create some (documented) array in the config file. Instead of this:

'maintenance_mode' => array(
    'enabled' => 'no',
),

it could be:

'maintenance_mode' => array(
    'enabled' => 'no',
    'status_header' => 'HTTP/1.1 503 Service Unavailable',
    'retry_after_header' => 'Retry-After: 3600',
),

If a header is not found in the config, it should not be sent.

Solution 2

To keep things simple, we might add the 503 header only. If someone needs more advanced headers (like above), he can still use the HTTP Response Header Mappings extension.

I prefer solution 2.

@nitriques
Copy link
Member

I prefer solution 2.

Me too. And the status_header can only be the numeric status code since we already have the mapping to string.

@michael-e
Copy link
Member

Agreed.

@brendo
Copy link
Member

brendo commented Mar 20, 2015

This is a good idea! I'm thinking we can send 503 by default, and then read a Retry value from the configuration? Or should we just use a sane retry default and if someone wants to modify it then they use the Response Mapping extension?

@michael-e
Copy link
Member

I'm thinking we can send 503 by default, and then read a Retry value from the configuration?

I like this idea. As long as the config's Retry-after value is empty (which is the default), we just send a 503. If it's not empty, we send this header as well. No additional extensions needed.

@jensscherbl
Copy link
Member

Or should we just use a sane retry default and if someone wants to modify it then they use the Response Mapping extension?

Sane default, please.

@michael-e
Copy link
Member

The right value might be 15 minutes (if you take your site down for an upgrade or similar) or several days (during development). I don't see a sane default.

@nitriques nitriques changed the title HTTP status HTTP status: Use 503 Service Unavailable Oct 6, 2016
@animaux
Copy link

animaux commented Aug 10, 2017

Anyone still into this?

@nitriques
Copy link
Member

@animaux I am still into it, but I have other things more urgent...

@nitriques nitriques self-assigned this Aug 10, 2017
@cylkee
Copy link
Author

cylkee commented Aug 10, 2017

I gave up on Maintenance Mode and I just modify .htaccess in cases where I need 503. I think Google et al will mostly ignore Retry-after, since they do things on their own time-frame. Debating over finer detail like that just delays what I think is quite a fundamental update to this extension.

Thanks for self-assigning, @nitriques.

@animaux
Copy link

animaux commented Aug 10, 2017

@nitriques thanks, it’s not urgent but a typical nice-to-have :)

@nitriques
Copy link
Member

Indeed ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants