Skip to content

Commit 5331525

Browse files
authored
[11.x] Fix cached health endpoint not working when in maintenance mode (#53974)
Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent fe5d94e commit 5331525

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Illuminate/Foundation/Configuration/ApplicationBuilder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ public function withRouting(?Closure $using = null,
161161
{
162162
if (is_null($using) && (is_string($web) || is_array($web) || is_string($api) || is_array($api) || is_string($pages) || is_string($health)) || is_callable($then)) {
163163
$using = $this->buildRoutingCallback($web, $api, $pages, $health, $apiPrefix, $then);
164+
165+
if (is_string($health)) {
166+
PreventRequestsDuringMaintenance::except($health);
167+
}
164168
}
165169

166170
AppRouteServiceProvider::loadRoutesUsing($using);
@@ -212,8 +216,6 @@ protected function buildRoutingCallback(array|string|null $web,
212216
}
213217

214218
if (is_string($health)) {
215-
PreventRequestsDuringMaintenance::except($health);
216-
217219
Route::get($health, function () {
218220
$exception = null;
219221

0 commit comments

Comments
 (0)