Skip to content

Instantly share code, notes, and snippets.

@sharshenov
Created November 16, 2015 11:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sharshenov/33c0dd55c838ecd5762c to your computer and use it in GitHub Desktop.
Save sharshenov/33c0dd55c838ecd5762c to your computer and use it in GitHub Desktop.
Rails middleware for health check endpoint
class HealthCheckResponder
def initialize(app, options = {})
@app = app
end
def call(env)
if env["REQUEST_PATH"] == "/health_check"
return [200, {}, [""]]
else
@app.call(env)
end
end
end
config.middleware.insert_before "Rails::Rack::Logger", "HealthCheckResponder"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment