Skip to content

[13.x] Support JSON responses for the built-in health route#59710

Merged
taylorotwell merged 3 commits into13.xfrom
health-route-json
Apr 15, 2026
Merged

[13.x] Support JSON responses for the built-in health route#59710
taylorotwell merged 3 commits into13.xfrom
health-route-json

Conversation

@WendellAdriel
Copy link
Copy Markdown
Member

@WendellAdriel WendellAdriel commented Apr 15, 2026

The framework's built-in health route always renders HTML, which is awkward for API-only applications whose load balancers, uptime monitors, and orchestrators expect JSON. Today those clients either scrape the HTML or register their own replacement route.

When the incoming request expects JSON ($request->expectsJson()), /up now returns:

{"status": "Application is up"}

or, when a DiagnosingHealth listener throws and debug mode is off:

{"status": "Application experiencing problems"}

Status codes (200 / 500) are unchanged, and requests that don't expect JSON keep getting the existing Blade page.

@WendellAdriel WendellAdriel marked this pull request as ready for review April 15, 2026 16:40
@taylorotwell taylorotwell merged commit 59e3746 into 13.x Apr 15, 2026
53 checks passed
@taylorotwell taylorotwell deleted the health-route-json branch April 15, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants