Skip to content

tribune/add_http_header

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AddHttpHeader

This gem provides Rack middleware which adds an http header to the response. You can either add a hard coded header, or provide a block that will get evaluated at runtime.

Example

# Add the host and build version to the header to make debugging production issues easier
host_info = "#{`hostname`.split('.').first}; #{BUILD_VERSION}"
Rails.configuration.middleware.insert_before(0, AddHttpHeader, 'X-Host-Info' => host_info)

# Add debug info about the request only on errors
Rails.configuration.middleware.insert_before(0, AddHttpHeader, 'X-Debug' => lambda{|env, status, headers| DebugInfo(env) if status >= 500})

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages