Using apache SSL reverse proxy with a rails application

I have a rails application running on a private subnet, using port 8080, without SSL enabled. I also have an Apache SSL server on a DMZ, which I use as a reverse proxy to the rails application I mention first.

The problem is, rails include some absolute url in the generated code, with adresses beginning with http://...

If i use config.force_ssl = true as I read here or there, there is a infinite redirection, because rails sees the requests coming as plain HTTP and issues a redirect to HTTPS, but as the client already is.

Upvotes: 2

Views: 637

Answers (1)

The solution was simple enough: put this line in the reverse proxy configuration file :

RequestHeader set X-Forwarded-Proto "https"

Upvotes: 3

Related Questions