Skip to content

Commit

Permalink
Removed Location header rewrite to prevent issues with varying ports.
Browse files Browse the repository at this point in the history
  • Loading branch information
superafroman committed Jan 12, 2011
1 parent 4ae3303 commit a5cabaf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/sproutcore/rack/proxy.rb
Expand Up @@ -97,6 +97,10 @@ def handle_proxy(proxy, proxy_url, env)
http_body = env['rack.input']
http_body.rewind

SC.logger << "Body: "
SC.logger << http_body
SC.logger << "\n"

some_request = Net::HTTPGenericRequest.new http_method.upcase,
true, true, http_path, headers

Expand All @@ -118,9 +122,10 @@ def handle_proxy(proxy, proxy_url, env)
# If this is a cookie, strip out the domain. This technically may
# break certain scenarios where services try to set cross-domain
# cookies, but those services should not be doing that anyway...
value.gsub!(/domain=[^\;]+\;? ?/,'') if key.downcase == 'set-cookie'
# value.gsub!(/domain=[^\;]+\;? ?/,'') if key.downcase == 'set-cookie'
# Location headers should rewrite the hostname if it is included.
value.gsub!(/^http:\/\/#{http_host}(:[0-9]+)?\//, "http://#{http_host}:#{http_port}/") if key.downcase == 'location'
# value.gsub!(/^http:\/\/#{http_host}(:[0-9]+)?\//, "http://#{http_host}:#{http_port}/") if key.downcase == 'location'
value.gsub!(/^http:\/\/#{http_host}(:[0-9]+)?\//, "/") if key.downcase == 'location'
# content-length is returning char count not bytesize
if key.downcase == 'content-length'
if response.body.respond_to?(:bytesize)
Expand Down

0 comments on commit a5cabaf

Please sign in to comment.