Maintenance mode is an important aspect of any web application’s lifecycle, allowing us, the developers, to perform updates, fixes, and improvements.
In Laravel, you can get your application into maintenance mode by executing the php artisan down
command.
But this makes it so that no one can access the application, not even you, the developer.
In this tutorial, I will show you how to bypass the maintenance mode and access the application.
Bypassing the Maintenance Mode
We have two options:
php artisan down --secret=your-secret-key
php artisan down --with-secret
— tells Laravel to generate a secret token
I’d choose the latter as it’s more secure.
Copy the generated key then navigate to your project URL and add it to the base URL (i.e https://example.com/YourGeneratedSecretKeyGoesHere
).
You should now be able to bypass the maintenance mode and have access to the application.
🎥 Check out this video for a showcase of this functionality:
How does it work?
To accomplish this, Laravel sets a laravel_maintenance
cookie on your browser.
As long as you have the cookie, you can access the app bypassing the maintenance mode.
Let me know what you think about this article in the comments section below.
If you find this article helpful, please share it with others and subscribe to the blog to support me, and receive a bi-monthly-ish e-mail notification on my latest articles.