0

I don't know much about maintenance mode in Laravel. I am currently using middleware that gets the status of the site from the db and if it is closed, redirects to a maintenance view.

What are the benefits of using Laravel's maintenance mode over this method?

David Eisenstat
  • 64,237
  • 7
  • 60
  • 120

1 Answers1

0

Laravel's maintenance mode offers a few features that you don't get from simply redirecting to a maintenance page. Whether or not you need these just depends on your particular setup.

https://laravel.com/docs/5.8/configuration#maintenance-mode

  1. If you have queued tasks, the queues will be paused during maintenance mode and resume when maintenance stops.
  2. It automatically sends a 503 status response, which is useful for API requests.
  3. It allows you to send a retry header in your response, so the requester can programmatically know how long to wait before trying again.

You could implement these yourself, but Laravel already has them for free. You can also customize Laravel's maintenance view, so you can still show users your own custom maintenance page when the site is down.

Just to note, there are some cases where Laravel's default maintenance mode isn't enough. If you have a multi-tenant setup on a single server, and you want to allow each tenant to enter maintenance mode independently of the others, then you would have to build your own solution.

newUserName02
  • 1,598
  • 12
  • 17