Skip to content

Commit 97558dc

Browse files
committed
Merge pull request #29 from ariejan/master
Added documentation on nginx/proxy setups
2 parents 8a87b6e + bea415e commit 97558dc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.rdoc

+15
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,21 @@ This can be done using a coder with Rack::Session::Cookie.
7474
See: [https://github.com/rack/rack/blob/master/lib/rack/session/cookie.rb#L28-42]
7575

7676

77+
== Deployment
78+
79+
If you run your application behind a proxy (e.g. Nginx) you may need to do some configuration on that side. If you don't you may experience an infinite redirect loop.
80+
81+
The reason this happens is that Rack::SslEnforcer can't detect if you are running SSL or not. The solution is to have your front-end server send extra headers for Rack::SslEnforcer to identify the request protocol.
82+
83+
=== Nginx
84+
85+
In the `location` block for your app's SSL configuration, include the following proxy header configuration:
86+
87+
proxy_set_header X-Forwarded-Proto https;
88+
89+
This makes sure that Rack::SslEnforcer knows it's being accessed over SSL. Just restart Nginx for these changes to take effect.
90+
91+
7792
== TODO
7893

7994
* Add configuration option to specify local http / https ports

0 commit comments

Comments
 (0)