Passenger and ServerAlias not cooperating
I have a ruby application that runs on a server with multiple IP addresses and mutliple vhosts. Here is the configuration of the problematic virtual host:
<VirtualHost 10.0.0.10:80>
ServerName realname.example.com
ServerAlias alias.example.com DocumentRoot /var/www/sites/example/current/public
<Directory /var/www/sites/example/current/public>
AllowOverride all
Options -MultiViews
</Directory> ErrorLog /var/log/httpd/example_error_log
CustomLog /var/log/httpd/example_access_log common RailsEnv production
RackEnv production
</VirtualHost>
When I pull up realname.example.com the Ruby on Rails application works correctly.
On the other hand alias.example.com just gives me Not Found: /
I’m fairly certain the correct vhost is getting used because alias.example.com produces a 404 in the correct log file.
I’ve tried adding logging to the Passenger config and it seems to indicate that Passenger is getting the request.
Note: I can’t redirect alias.example.com to realname.example.com. realname is accessed using a CDN, whereas alias is directly accessed.
Anyone have any ideas why this isn’t working? I’ve been banging my head for days and I’ve got a similar configuration in QA that works as expected.
Turns out the problem was this Apache directive:
UseCanonicalName On
Check more discussion of this question.
Related posts:
- Exclude specific domains from Apache2 serverAlias while using a catch all *(wildcard) alias
- mod-redmine && mod-passenger: Passenger refuses to load (here: Redmine) after rewrite uri. Where to put RailsBaseURI?
- apache2 VirtualHost server and passenger behaviour
- Ruby on Rails/Passenger with Apache2 – setting up sub domains
- ServerAlias not working
Leave a comment
Recent Posts
- Windows File Permissions and Attributes
- What is the easiest way to upgrade my existing Perl 5.14 to Perl 5.16 on FreeBSD 9 using the ports system?
- Know if mysql has done its job
- Redirect https .com to https .co.uk without a valid SSL cert on .com without DNS change
- Why is it a bad idea to use customer email as from address





