A Dynamic Reverse Proxy for Rack
Installation
Add this line to your application's Gemfile:
gem 'rack-dynamic-reverse-proxy'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rack-dynamic-reverse-proxy
Usage
require "rack-dynamic-reverse-proxy"
use Rack::DynamicReverseProxy do
preserve_host: true
reverse_proxy_rule do |env|
if /test/.match env.fullpath
'http://example.com/'
end
end
end
app = proc do |env|
[
200,
{ 'Content-Type' => 'text/html' },
['<html><body>test</body></html>']
]
end
run app
Contributing
- Fork it ( https://github.com/k-shogo/rack-dynamic-reverse-proxy/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request