Tuesday, April 15, 2008

Nginx and Ruby on Rails ssl_requirement

ssl_requirement plugin was causing infinitive loop.
It was because request.ssl? was always returning false in ensure_proper_protocol method inside SslRequirement.
Actually, request.ssl? method is checking the value of X-FORWARDED_PROTO.

So it turned out that you have to set X-FORWARDED_PROTO in Nginx's configuation file.
server {
location / {
proxy_set_header X-FORWARDED_PROTO https;

No comments: