0.01
No commit activity in last 3 years
No release in over 3 years
Simple Rack middleware for adding custom HTTP headers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0
~> 2.99

Runtime

 Project Readme

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})