class Rails::Rack::SilenceRequest
This middleware can also be configured using ‘config.silence_healthcheck_path = “/up”` in Rails.
Rails::Rack::Logger, Rails::Rack::SilenceRequest, path: “/up”
config.middleware.insert_before <br>
Example:
This middleware is used to do just that against the path /up in production by default.
This is useful for preventing recurring requests like health checks from clogging the logging.
Allows you to silence requests made to a specific path.
def call(env)
def call(env) if env["PATH_INFO"] == @path Rails.logger.silence { @app.call(env) } else @app.call(env) end end
def initialize(app, path:)
def initialize(app, path:) @app, @path = app, path end