Skip to content

Commit ea35f41

Browse files
authored
[11.x] Ignore health endpoint when in maintenance mode (#53772)
* Ignore health endpoint when in maintenance mode Currently if you use any liveliness or readiness checks in your app such as with Kubernetes, if you put the app into maintenance mode, it clobbers the health endpoint and starts returning 503 response, which triggers the infra to spin up new containers in an attempt to resolve the unhealthy containers... This we do not not to happen. This PR puts the health endpoint into the exception list for preventing requests during maintenance. * style fixes
1 parent 01cffb4 commit ea35f41

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Illuminate/Foundation/Configuration/ApplicationBuilder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Illuminate\Foundation\Application;
1111
use Illuminate\Foundation\Bootstrap\RegisterProviders;
1212
use Illuminate\Foundation\Events\DiagnosingHealth;
13+
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance;
1314
use Illuminate\Foundation\Support\Providers\EventServiceProvider as AppEventServiceProvider;
1415
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as AppRouteServiceProvider;
1516
use Illuminate\Support\Collection;
@@ -211,6 +212,8 @@ protected function buildRoutingCallback(array|string|null $web,
211212
}
212213

213214
if (is_string($health)) {
215+
PreventRequestsDuringMaintenance::except($health);
216+
214217
Route::get($health, function () {
215218
$exception = null;
216219

0 commit comments

Comments
 (0)