How Laravel 11 Introduces a Built‑in Health Check Route (/up)
Laravel 11 adds a default health‑check endpoint accessible via the /up route, configured in bootstrap/app.php, which dispatches a DiagnosingHealth event and returns an animated "Application up" page to verify application status.
Laravel 11 adds a built‑in health‑check endpoint that can be accessed via the /up route.
The route is defined through the health‑check parameter in the new bootstrap/app.php configuration. By default Laravel configures it as follows:
Application::configure(basePath: dirname(__DIR__))
->withProviders()
->withRouting(
web: __DIR__.'/../routes/web.php',
// api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
// channels: __DIR__.'/../routes/channels.php',
health: '/up',
);When the health route is registered, Laravel dispatches a DiagnosingHealth event. The default implementation returns a simple view that shows an animated “Application up” page.
use Illuminate\Foundation\Events\DiagnosingHealth;
if (is_string($health)) {
Route::middleware('web')->get($health, function () {
Event::dispatch(new DiagnosingHealth);
return View::file(__DIR__.'/../resources/health-up.blade.php');
});
}The endpoint can be accessed at /up and will display the health page in the browser.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
