ncr / rack-proxy

A request/response rewriting HTTP proxy. A Rack app.
MIT License
269 stars 94 forks source link

Returning header values as array is causing Rack::Lint to throw exceptions #32

Closed nhemsley closed 10 years ago

nhemsley commented 10 years ago

Im having issues proxying a rails dev setup as a rack middleware.

Using this file as a rack middleware: https://gist.github.com/nhemsley/9119755

to basically proxy from one server, to another one on my machine running on a different port

When perform_request is called, the headers are returned on this line: https://github.com/ncr/rack-proxy/blob/master/lib/rack/proxy.rb#L100

they are of the form:

{"x-frame-options"=>["SAMEORIGIN",] "x-xss-protection"=>["1; mode=block"], ...}

which causes rack here:

https://github.com/rack/rack/blob/master/lib/rack/lint.rb#L584 to blow up.

Sorry I dont have a stack trace or test to reproduce, I had a quick look how to add this to a test, but there appear to be too many working parts for my brain to cope with..

It appears rack is not liking how the core NET:HTTP is returning the headers. So go figure.

nhemsley commented 10 years ago

This PR fixes the problem I am seeing, but this PR is mainly to illustrate the problem if it is not clear enough..

https://github.com/ncr/rack-proxy/pull/33

nhemsley commented 10 years ago

I will reopen this with a better test case