Skip to content

Commit 634918a

Browse files
committed
Merge pull request jaswope#10 from monkseal/master
Update README.md to include sample usage in a Ruby on Rails app
2 parents c15e2b6 + 72bb5c9 commit 634918a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,28 @@ reverse_proxy_options sets global options for all reverse proxies. Available opt
5050
* `:matching` is a global only option, if set to :first the first matched url will be requested (no ambigous error). Default: :all.
5151
* `:timeout` seconds to timout the requests
5252

53+
### Sample usage in a Ruby on Rails app
54+
55+
Rails 3 or less:
56+
57+
```ruby
58+
# config/application.rb
59+
config.middleware.insert_before(Rack::Lock, Rack::ReverseProxy) do
60+
reverse_proxy_options preserve_host: true
61+
reverse_proxy '/wiki', 'http://wiki.example.com/'
62+
end
63+
```
64+
65+
Rails 4+ or if you use `config.threadsafe`, you'll need to `insert_before(Rack::Runtime, Rack::ReverseProxy)` as `Rack::Lock` does not exist when `config.allow_concurrency == true`:
66+
67+
```ruby
68+
# config/application.rb
69+
config.middleware.insert_before(Rack::Runtime, Rack::ReverseProxy) do
70+
reverse_proxy_options preserve_host: true
71+
reverse_proxy '/wiki', 'http://wiki.example.com/'
72+
end
73+
```
74+
5375
## Note on Patches/Pull Requests
5476
* Fork the project.
5577
* Make your feature addition or bug fix.

0 commit comments

Comments
 (0)