ncr / rack-proxy

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

Add ability to explicitly set the backend #15

Closed ismell closed 11 years ago

ismell commented 11 years ago

This should fix issue #14.

Here is the example usage

require 'rack-proxy'

class CwsProxy < Rack::Proxy
  def initialize
    super :backend => MyConfig.backend_uri
  end

  def rewrite_env(env)
    env["HTTP_X_FORWARDED_HOST"] = env["HTTP_HOST"]
    env["HTTP_HOST"] = MyConfig.backend_uri.host

    env
  end

  def rewrite_response(triplet)
    status, headers, body = triplet
    headers.delete("status")
    triplet
  end
end
ncr commented 11 years ago

Looks fine to me! Thank you :+1:

ismell commented 11 years ago

When is the next release scheduled? I would like to use this in my project but not have to specify the :git parameter in my Gemfile.

Thanks, Raul

ncr commented 11 years ago

Hmm, you're right, I'll release the updates tomorrow.

Jacek Becela http://flic.kr/ncr

Dnia 21 cze 2013 o godz. 20:52 Raul E Rangel notifications@github.com napisał(a):

When is the next release scheduled? I would like to use this in my project but not have to specify the :git parameter in my Gemfile.

Thanks, Raul

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

ncr commented 11 years ago

Just pushed 0.4

ismell commented 11 years ago

Awesome thanks!