레일 3:URL에 '/'를 추가하여 발생하는 리디렉션 루프
-
14-11-2019 - |
문제
배경 정보
설정:레일스 3 + Apache2 + Phusion Passenger 3.0.7
내 도메인의 하위 URI(Rails 3 앱이기도 함)에 Rails 3 앱을 배포했습니다.저는 Phusion Passenger 3.0.7을 사용하여 Rails 앱을 배포하고 있습니다.
문제
탐색할 때 http://mydomain.com/suburi/ 나는 HTTP/1.1 301 Moved Permanently
메시지.첨부된 내용을 확인하세요. /
.그러나 탐색할 때 http://mydomain.com/suburi/home, 또는 http://mydomain.com/suburi 모든 것이 잘 작동합니다.
어떤 도움이라도 주시면 감사하겠습니다.
내 Apache 구성 파일은 다음과 같습니다.
<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>
내 Routes.rb 파일은 다음과 같습니다.
MyApp::Application.routes.draw do
# snipped code that wouldn't affect anything...
root :to => "home#index"
end
해결책
범인은 결국 그 사람이었다. mod_speling
내가 활성화한 Apache 모듈 CheckSpelling on
.모듈을 비활성화한 후에는 더 이상 문제가 발생하지 않았습니다.
제휴하지 않습니다 StackOverflow