From Laravel 8, you can bypass maintenance mode only for you with a secret route! It's a really nice and flexible feature to bypass maintenance mode only for you and your developer when the application in maintenance mode. We can use this kind of features in our existing laravel 6, laravel 7 projects with a lightweight laravel package called haruncpi/laravel-maintenance. Let's see how we can use it our project.
Install package
composer require haruncpi/laravel-maintenance
Now replace the default maintenance middleware in app/Http/kernel.php
//\App\Http\Middleware\CheckForMaintenanceMode::class,
\Haruncpi\LaravelMaintenance\Middleware\MaintenanceMode::class,
Installation finished!
- Enable maintenance mode with secret route
php artisan down --secret="mysecretkey"
- Maintenance bypass
https://example.com/mysecretkey
Here mysecretkey
is a secret key which we defined earlier in artisan down command. Make sure you make it complex for better security.
After visiting the secret route, you will get the application live only in your side and the rest of the world gets it in maintenance mode.
Doc & GitHub repository: haruncpi/laravel-maintenance
Top comments (0)