After redirecting users in a
Rails app, for some reason the slash after the domain is missing. Generated URLs are invalid and I'm forced to manually correct them. The problem only occurs on a subdomain. On a different primary domain (same server), everything works ok.
For example, after logging out, the site is directing to https://www.sub.domain.comlogin/ rather than https://www.sub.domain.com/login
I suspect the issue has something to do with the vhost setup, but I'm not sure. Here are the broken and working vhosts:
BROKEN SUBDOMAIN
<VirtualHost *:80>
ServerName www.sub.domain.com
ServerAlias sub.domain.com
Redirect permanent / https://www.sub.domain.com
</VirtualHost>
<VirtualHost *:443>
ServerAdmin
[email protected]
ServerName www.sub.domain.com
ServerAlias sub.domain.com
RailsEnv production
# SSL Engine Switch
SSLEngine on
# SSL Cipher Suite:
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
# Server Certificate
SSLCertificateFile /path/to/server.crt
# Server Private Key
SSLCertificateKeyFile /path/to/server.key
# Set header to indentify https requests for
Mongrel
RequestHeader set X_FORWARDED_PROTO "https"
BrowserMatch ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
DocumentRoot /home/usr/www/www.sub.domain.com/current/public/
<Directory "/home/usr/www/www.sub.domain.com/current/public">
AllowOverride all
Allow from all
Options -MultiViews
</Directory>
WORKING PRIMARY DOMAIN
<VirtualHost *:80>
ServerName www.diffdomain.com
ServerAlias diffdomain.com
Redirect permanent / https://www.diffdomain.com
</VirtualHost>
<VirtualHost *:443>
ServerAdmin
[email protected]
ServerName www.diffdomain.com
ServerAlias diffdomain.com
ServerAlias *.diffdomain.com
RailsEnv production
# SSL Engine Switch
SSLEngine on
# SSL Cipher Suite:
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
# Server Certificate
SSLCertificateFile /path/to/server.crt
# Server Private Key
SSLCertificateKeyFile /path/to/server.key
# Set header to indentify https requests for
Mongrel
RequestHeader set X_FORWARDED_PROTO "https"
BrowserMatch ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
DocumentRoot /home/usr/www/www.diffdomain.com/current/public/
<Directory "/home/usr/www/www.diffdomain.com/current/public">
AllowOverride all
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
Please let me know if there's anything else I could provide that would help determine what's wrong here.
UPDATE
tried adding a trailing slash to the redirect command, but still no luck.