Passenger's RailsBaseURI Not Working (well)?

Passenger (mod_rails) supports deploying a rails app to a sub URI. This is really a cool feature that makes our deployment work easier.

But RailsBaseURI seems to be not working well with Rails 2.2.2. For example, suppose we have an app called ‘projects’, which sits at http://ashchan.com/projects.

The configuration would be like this:

<VirtualHost *:80>
    ServerName ashchan.com
    DocumentRoot /path/to/ashchan.com
    RailsBaseURI /projects
</VirtualHost>

Now visit http://ashchan.com/projects, you’ll get a 404 error page.

The rails log file will tell you that there’s a RoutingError:

ActionController::RoutingError (No route matches "/projects" with {:method=>:get})

It appears Passenger hasn’t taken care of the relative url root for our projects app. To solve this problem, add this line to environment.rb:

config.action_controller.relative_url_root = "/projects"

This SHOULD be done automatically by Passenger! I just hate changing environment.rb to let the application run in different deployment ways.