简体   繁体   中英

Passenger: RailsBaseURI case sensitive?

I used Passenger to deploy a RoR app to a sub URI on my domain. The problem I'm facing is that the sub URI seems to be case sensitive. Navigating to http://mydomain.com/RailsApp resolves fine. However, if I go to http://mydomain.com/railsapp , http://mydomain.com/railsApp , or any other variation, I get a 404 error. How can these requests using different casings get resolved correctly?

Here is my Apache configuration file:

<VirtualHost *:80>
  ServerName mydomain.com
  ServerAlias www.mydomain.com
  DocumentRoot /www/mydomain/public

  <Directory "/www/mydomain/public">
      RailsEnv "production"
      Order allow,deny
      Allow from all
  </Directory>

  RailsBaseURI /RailsApp
  <Directory "/www/RailsApp/public">
      RailsEnv "development"
      Options -MultiViews
  </Directory>
</VirtualHost>

Any help is much appreciated. Thanks!

You could look into using mod_rewrite and matching it case insensitive there.

Some links to get you started :)
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
http://httpd.apache.org/docs/2.2/misc/rewriteguide.html

Thanks ba for pointing me in the right direction.

I did some research and found the mod_speling module. This not only makes the URL case-insensitive but also checks for spelling errors.

To enable mod_speling:

sudo /usr/sbin/a2enmod speling

sudo /etc/init.d/apache2 force-reload
sudo /etc/init.d/apache2 restart

To use mod_speling, include the directive CheckSpelling on in your virtual host section:

<VirtualHost *:80>
    CheckSpelling on

    ...
</VirtualHost>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM