On my public-facing Apache2 server access to my Rails 3 app is via a sub-URI, like
https://www.myserver.com/myapp/controller...
that server is configured for reverse proxy to another Apache2 server hosting the Rails app via Passenger:
http://intranet.server.com/myapp
In my VirtualHost settings for the intranet server I have
SetEnv RAILS_RELATIVE_URL_ROOT "/myapp"
In my config/environments/production.rb file I uncommented the line
config.log_level = :debug
This way, the very first executing method in my app issues:
logger.debug { "The environment variable RAILS_RELATIVE_URL_ROOT is presently #{ENV['RAILS_RELATIVE_URL_ROOT']}" }
and sure enough, in the production log file you see:
The environment variable RAILS_RELATIVE_URL_ROOT is presently /myapp
However, the next line in the log is, which is obviously what the browser goes to:
Redirected to https://www.myserver.com/controller/action
I learned about this environment variable here on Stackoverflow, so that's one person for whom it worked, but one other person chimed it didn't to which another said it did. So with my experience, we're now at a tie. Am I missing something?
I figured out my error. The reverse proxy settings on the external server referenced just the hostname of the internal server and left off the path to my RoR3 app.