开发者

Rails 3: Redirect loop caused by appended `/` to URL

开发者 https://www.devze.com 2023-03-07 02:09 出处:网络
Background Info setup: Rails 3 + Apache2 + Phusion Passenger 3.0.7 I deployed a Rails 3 app to a sub URI on my domain (which is also a Rails 3 app). I\'m using Phusion Passenger 3.0.7 to deploy my R

Background Info

setup: Rails 3 + Apache2 + Phusion Passenger 3.0.7

I deployed a Rails 3 app to a sub URI on my domain (which is also a Rails 3 app). I'm using Phusion Passenger 3.0.7 to deploy my Rails apps.

The Problem

When navigating to http://mydomain.com/suburi/ I get a HTTP/1.1 301 Moved Permanently message. Notice the appended /. However, when navigating to http://mydomain.com/suburi/home, or http://mydomain.com/suburi everything works fine.

Any help would be much appreciated.

Here is my Apache configuration file:

<VirtualHost *:80>
  CheckSpelling on

  PassengerFriendlyErrorPages Off

  ServerName mydomain.com
  ServerAlias www.mydomain.com
  DocumentRoot /www/mydomain/public

  <Directory /www/mydomain/public>
      RackEnv production
      Options FollowSymLinks -MultiViews
      Order allow,deny
      Allow from all
      AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript
  </Directory>

  RackBaseURI /suburi
  <Directory /www/mydomain/public/suburi>
      RackEnv production
      AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript
      Options -MultiViews
  </Directory>
</VirtualHost>

Here is my routes.rb file:

MyApp::Application.routes.draw do   

    # snipped code that wouldn't affect anything...

    root :开发者_开发百科to => "home#index"
end


The culprit ended up being the mod_speling Apache module I had enabled via CheckSpelling on. After disabling the module, I had no further problems.

0

精彩评论

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

关注公众号