-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[5.6] Define routes that are accessible while in maintenance mode #24731
[5.6] Define routes that are accessible while in maintenance mode #24731
Conversation
Seems like that information should be made available on the maintenance page. |
The PR is not about the compliance with any law; it's just a possible use case. But let's push it a litte bit further: You not only need to show who's the service provider but also declare how you handle the users privacy which is (thanks to the GDPR) a very very long page. Sure enough you could display that on your maintenance page too, but this would not be a nice "Be right back" anymore. Or another idea: Your application consists of some static frontend pages for new users to inform about your app and during maintenance you want your potential new customers to look at those static pages whilst the "customer panel" is down for maintenance. There are many possible use case I could imagine for this and there is no disadvantage for devs who don't want to use the feature. |
I think you should provide some tests for this feature |
The description of the option is a little misleading. It says names of routes but it's actually request URIs? |
@taylorotwell The wording was indeed misleading, sorry. You need to provide the URIs because of the way the maintenance mode is currently working in Laravel. The |
@@ -45,6 +45,10 @@ public function handle($request, Closure $next) | |||
return $next($request); | |||
} | |||
|
|||
if (isset($data['except']) && in_array($request->getRequestUri(), (array) $data['except'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would personally expect to have exactly the same feature as \Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::inExceptArray
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea, thank you! This is even better.
I'm closing this PR in favor of @lucasmichot's idea to adopt the same behavior of the |
This pull request adds a minor feature to the
artisan down
command and the CheckForMaintenanceMode middleware. The user is able to define routes that shall be excluded from maintenance mode which is especially useful when the developer wants to continue to serve e.g. static pages with useful or even required information.Possible Use Case
Example: To comply with EU-law the service provider of a commercial website is required to make sure that every visitor is able to see who is running the website (Legal information page). To prevent legal actions from competitors they may want to show those (static) pages even when the application is in maintenance mode.
Usage
php artisan down --except=/legal --except=/privacy
This will result in maintenance mode for the whole application but requests to the routes
/legal
and/privacy
won't be filtered out by the maintenance middleware.Breaking Changes
None! It's an optional parameter for the
artisan down
command that does not affect the usage of the other commands in any way. Also the specific check in the middleware is only run when the$data['except']
field is set.Further discussion
see: laravel/ideas#1242