I have a server A which proxies all traffic on /rails
to server B.
So I setup this virtual host, and most things work...okay. link_to
is broken and generates urls to /users
as opposed to /rails/users
, but I can work around that.
If I set config.action_controller.relative_url_root
to /rails
then my routes work okay EXCEPT all the devise routes. They point to the bare URL. How do I properly configure server B to understand that its running in a subdirectory and generate links and routes correctly?
<VirtualHost *:80>
ServerName http://ec2-url.compute-1.amazonaws.com/
SetEnv RDS_HOSTNAME "mydb..."
SetEnv RAILS_RELATIVE_URL_ROOT "/rails"
DocumentRoot /home/ubuntu/myapp/public
RailsEnv staging
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/app.log combined
PassengerLogLevel 3
<Directory "/home/ubuntu/myapp/public">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>
I am using Rails 4.