laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

Make browsers actually retry when app is in maintenance mode #2558

Closed bjuppa closed 3 years ago

bjuppa commented 3 years ago

The docs say that php artisan down --retry=60 will send a Retry-After header along with the 503 response when the app is in maintenance mode.

What it doesn't tell us is that no browsers actually implement the expected retry after the passed time... 😄 It's basically only googlebot that cares about that header.

A practical solution to get the desired user experience in most browsers is to also send a Refresh header containing the timeout in seconds. The Refresh header is unfortunately undocumented but nonetheless it seems to have the desired effect in real world browsers!

I suggest adding a new --refresh option to the artisan down command that sets a separate Refresh header, and document the practical difference between the two options.

Adding this as a new option is probably good to avoid surprising anyone with an unexpected change in behavior in a part of your app you most likely never test before using... 😄

themsaid commented 3 years ago

Thanks for the suggestion. Submitted a PR for review: https://github.com/laravel/framework/pull/37385