Between Passenger and Rails, lowercase underscores in URLs are not processed properly

I have a Rails application deployed to my server in context scala_tour. When going to the url everything works fine. However, if the url is encoded to scala%5ftour(which, incidentally, does SO, by the way), I get a Rails and / or Passenger error message.

The passenger seems to recognize the URL and passes it to my Rails application, but the Rails application complains about:

ActionController::RoutingError (No route matches "/scala%5Ftour" with {:method=>:get}):

This is pretty weird.

Besides forwarding to Apache and deploying my application in a different context, how can I handle this?

Version

# yum list installed | grep http
httpd.i386                               2.2.10-2.el5.eapps     installed    
# yum list installed | grep passen
passenger.i386                           2.2.2-1eapps           installed 
# gem list | grep rails
rails (2.3.2, 2.2.2)
# ruby -v
ruby 1.8.6 (2008-06-20 patchlevel 230) [i386-linux]

routes.rb

ActionController::Routing::Routes.draw do |map|
  map.resources :wiki_pages do |wiki_map|
    wiki_map.history 'history', :controller => 'wiki_pages', :action => 'history', :method => 'GET'
    wiki_map.version 'version/:sha1', :controller => 'wiki_pages', :action => 'version', :method => 'GET'
  end
  map.history '/history.:format', :controller => 'wiki_pages', :action => 'wiki_history', :method => 'get'
  map.resources :diagrams, :only => [:index,:new,:destroy,:edit,:show]
  map.logout '/logout', :controller => 'sessions', :action => 'destroy' 
  map.login '/login', :controller => 'sessions', :action => 'new'
  map.resources :users
  map.resource :session
  map.root :controller => 'wiki_pages', :action => 'show', :id => 'MainPage'
end

Apache conf

RailsBaseURI /scala_tour
PassengerPoolIdleTime 5
+3
source share
2 answers

, mod_rewrite apache URL-, Rack Middleware , - , , , .

+1

Source: https://habr.com/ru/post/1717371/


All Articles