ncr / rack-proxy

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

Getting error while running: undefined method `key?' #20

Closed jamiri closed 10 years ago

jamiri commented 11 years ago

Thanks for your work. In my rails app when I create and add a middle-ware that uses rack-proxy, I'm getting this error after running the rails server:

gems/ruby-1.9.3-p194/gems/rack-proxy-0.5.1/lib/rack/proxy.rb:12:in initialize': undefined methodkey?' for #MetaRequest::Middlewares::MetaRequestHandler:0xbb0cd30 (NoMethodError)

Even I tried to remove meta_request gem and apparently the proxy has issue with another gem (or middle-ware) i.e.

/gems/ruby-1.9.3-p194/gems/rack-proxy-0.5.1/lib/rack/proxy.rb:12:in initialize': undefined methodkey?' for #ActionDispatch::Routing::RouteSet:0xa675930 (NoMethodError)

Any ideas why that happens?

ncr commented 11 years ago

Thanks for the feedback, I'll get to this when I'm back from vacation :)

Jacek Becela http://flic.kr/ncr

Dnia 18 wrz 2013 o godz. 14:08 Javad notifications@github.com napisał(a):

Thanks for your work. In my rails app when I create and add a middle-ware that uses rack-proxy, I'm getting this error after running the rails server:

gems/ruby-1.9.3-p194/gems/rack-proxy-0.5.1/lib/rack/proxy.rb:12:in initialize': undefined methodkey?' for #MetaRequest::Middlewares::MetaRequestHandler:0xbb0cd30 (NoMethodError)

Even I tried to remove meta_request gem and apparently the proxy has issue with another gem (or middle-ware) i.e.

/gems/ruby-1.9.3-p194/gems/rack-proxy-0.5.1/lib/rack/proxy.rb:12:in initialize': undefined methodkey?' for #ActionDispatch::Routing::RouteSet:0xa675930 (NoMethodError)

Any ideas why that happens?

— Reply to this email directly or view it on GitHub.

jamiri commented 10 years ago

Thanks for your effort to address the issue. Unfortunately I get the same error now with fetch as follows:
'initialize': undefined method 'fetch' for #MetaRequest::Middlewares::MetaRequestHandler:0xbb0cd30 (NoMethodError).

Any ideas?

ncr commented 10 years ago

Yes, it seems that Rack::Proxy instead of some options (a Hash) is initialized with the other middlewares. Actually this is a kind of a standard that the first argument to the middleware is the previous middleware. The problem is, that RackProxy is not a middleware, it is a rack app so it needs to be mounted (like here: http://inductor.induktiv.at/blog/2010/05/23/mount-rack-apps-in-rails-3/) instead of inserted as middleware. Hope this helps :)

jamiri commented 10 years ago

Thanks! It works now, but it seems that it is not possible to alter websocket connections using rack proxy right?

ncr commented 10 years ago

Not sure. Probably not

2013/10/6 Javad notifications@github.com

Thanks! It works now, but it seems that it is not possible to alter websocket connections using rack proxy right?

— Reply to this email directly or view it on GitHubhttps://github.com/ncr/rack-proxy/issues/20#issuecomment-25763252 .

Jacek Becela

http://trix.pl http://github.com/ncr http://linkedin.com/in/jacekbecela http://twitter.com/jacekbecela