Skip to content

Enable Rails built-in health check endpoint at /up#92

Merged
JuanVqz merged 1 commit into
mainfrom
feature/rails-health-endpoint
Jul 10, 2026
Merged

Enable Rails built-in health check endpoint at /up#92
JuanVqz merged 1 commit into
mainfrom
feature/rails-health-endpoint

Conversation

@JuanVqz

@JuanVqz JuanVqz commented Jul 10, 2026

Copy link
Copy Markdown
Member

What

Enables Rails' built-in health check endpoint at /up by mounting Rails::HealthController#show:

get "up" => "rails/health#show", as: :rails_health_check

No custom controller. This is the framework's own one-size-fits-all health check, introduced in Rails 7.1.

Why

Uptime monitors, load balancers, and container orchestrators need a stable endpoint to poll. The built-in controller returns 200 when the app boots with no exceptions and 500 otherwise.

Behavior

The controller responds to all three request styles we need, from a single route:

Request Response
Accept: text/html (browser) 200, green HTML page
Accept: application/json 200, {"status":"up","timestamp":...}
Bot / no Accept / */* 200, HTML page

Verified locally against a booted server (all 200). No host_authorization or allow_browser guard blocks it, and it runs as a standalone ActionController::Base, so protect_from_forgery / CSRF does not apply.

Notes

Per the Rails docs, this endpoint reflects only that the app booted, not the status of downstream dependencies (DB, S3). That is the intended scope of rails/health#show; a dependency-aware check would need a custom action, which is deliberately out of scope here.

Mounts Rails::HealthController#show at /up (rails_health_check). Returns
200 when the app boots cleanly, 500 otherwise. The controller responds
with an HTML page for browsers/uptime bots and a JSON body for
Accept: application/json clients, so load balancers, monitors, and JSON
consumers share one endpoint. No custom controller.
@JuanVqz JuanVqz self-assigned this Jul 10, 2026
@JuanVqz JuanVqz marked this pull request as ready for review July 10, 2026 16:25
@JuanVqz JuanVqz merged commit 72e1a35 into main Jul 10, 2026
2 checks passed
@JuanVqz JuanVqz deleted the feature/rails-health-endpoint branch July 10, 2026 16:26
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.

1 participant