Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A request/response rewriting HTTP proxy. A Rack app.
Branch: master
Pull request Compare This branch is 81 commits behind ncr:master.
Failed to load latest commit information.
lib Use bundler for gem building
test Convert headers with underscores back to dashes.
.gitignore Use bundler for gem building
Gemfile Use bundler for gem building
Gemfile.lock Add lock
Rakefile
Readme Add warning regarding fakeweb/webmock monkey-patching conflicts.
rack-proxy.gemspec Use bundler for gem building

Readme

A request/response rewriting HTTP proxy. A Rack app.

Subclass Rack::Proxy and provide your rewrite_env and rewrite_response methods.

Example:

class Foo < Rack::Proxy

  def rewrite_env(env)
    env["HTTP_HOST"] = "example.com"

    env
  end

  def rewrite_response(triplet)
    status, headers, body = triplet

    headers["X-Foo"] = "Bar"

    triplet
  end

end

See tests for more examples.

WARNING: Doesn't work with fakeweb/webmock. Both libraries monkey-patch net/http code.
Something went wrong with that request. Please try again.