Closed paulie4 closed 11 years ago
That was not the right way to fix it, since the base application needs to know the HTTP_X_FORWARDED_HOST value to properly create links. Instead of deleting that env key, I edited rack-proxy-0.3.7/lib/rack/proxy.rb so target_response = HttpStreamingResponse.new() has this host value: env["HTTP_HOST"].split(/:/)[0] and has this port value: env["HTTP_HOST"].split(/:/)[1] ? env["HTTP_HOST"].split(/:/)[1].to_i : 80
I think there needs to be a way to specify the backend when the proxy is constructed.
Just merged #15 which helps with this issue.
I'm using https://github.com/layervault/divergence, which uses rack-proxy. I have an Apache proxy in front of the rack-proxy to provide an HTTPS layer. Unfortunately, Ruby Rack's Rack::Request is getting its host and port values (which rack-proxy uses for its Net::HTTP connection) from env["HTTP_X_FORWARDED_HOST"] instead of from env["HTTP_HOST"](Divergence is expecting rack-proxy to send the request to env["HTTP_HOST"]), so the request gets sent to the wrong place. I'm not sure if this is an error in rack-proxy or in Divergence.
The workaround I did was to first delete the "HTTP_X_FORWARDED_HOST" key from env before Divergence calls rack-proxy's perform_request(), but I'm not sure if that is the best way to fix this. What do you guys think?