开发者

Passenger: RailsBaseURI case sensitive?

开发者 https://www.devze.com 2022-12-29 05:57 出处:网络
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. Howeve

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 "producti开发者_运维知识库on"
      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>
0

精彩评论

暂无评论...
验证码 换一张
取 消