From 75dd92db1e368a7f22911b6f11c847c887220c47 Mon Sep 17 00:00:00 2001 From: Blake Watters Date: Tue, 22 Nov 2011 17:09:04 -0500 Subject: [PATCH] Replace all instances of '_' with '-' in header name before proxying. Ensures compatibility when proxying Heroku requests to other Heroku apps --- lib/rack/reverse_proxy.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rack/reverse_proxy.rb b/lib/rack/reverse_proxy.rb index b7acfcf..aa195b2 100644 --- a/lib/rack/reverse_proxy.rb +++ b/lib/rack/reverse_proxy.rb @@ -20,7 +20,8 @@ def call(env) headers = Rack::Utils::HeaderHash.new env.each { |key, value| if key =~ /HTTP_(.*)/ - headers[$1] = value + header = $1.gsub('_', '-') + headers[header] = value end } headers['HOST'] = uri.host if all_opts[:preserve_host]