I have a rails app which provides real-time functionality through Faye. My clients are going to access the Faye server through **example.com:9292/faye**. Instead of using that address and revealing my machine's open ports, I am trying to add a rack middleware and by using 'rack-proxy' gem, proxy my **example.com/faye** requests to **example.com:9292/faye**. My Rails middleware code looks like this:

```
class FayeProxy < Rack::Proxy
  def rewrite_env(env)
    request = Rack::Request.new(env)
    if request.path =~ %r{^/faye}
      env["HTTP_HOST"] = "localhost:9292"
    end
    env
  end
 end

```

Also I added the middleware to **config/application.rb** by `config.middleware.use "FayeProxy"`, but when I run my rails server I get the following error:

*/gems/ruby-1.9.3-p194/gems/rack-proxy-0.5.0/lib/rack/proxy.rb:12:in 'initialize': undefined method `key?' for # (NoMethodError)*

and even if I remove meta\_request gem I will get 

\*/gems/ruby-1.9.3-p194/gems/rack-proxy-0.5.1/lib/rack/proxy.rb:12:in `initialize': undefined method`key?' for # (NoMethodError)
\*

Any help is really appreciated if anybody has experienced this before or knows the solution.

P.s. I'm using Rails 3.2.13, rack 1.4.5, rack-proxy 0.5.1.