Send As SMS
Transcraft Blog
The choice of the IT professionals

Sunday, January 15, 2006

Bug in Rails 1.0 for fcgi when under virtual host

I upgraded to Rails 1.0 on Apache running on Linux with fcgi,
and the dispatcher immediately throws error on all static paths like images,javascripts,stylesheets etc.
I have one Rails project running under virtual host, the other under aliased path, and both are broken the same way.

Rolling back to Rails 0.14.3 fixes the problem immediately.

This is not a problem under WEBrick, leading me to think it is to do with the .htaccess file URL rewriting. Looking at the generated paths in the HTML, I can see what the problem is too, in that typically a path like /images/foo.gif in v0.14.3 is now incorrectly rendered as /dispatch.fcgi/images/foo.gif i.e. the name of the fcgi file in the "public" directory has somehow been appended to the base url, causing the document root to be pushed down one level. In the log file, I get this exception for each requested static file:

ActionController::RoutingError (Recognition failed for "/images/links.gif"):
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/routing.rb:469:in `recognition_failed'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/routing.rb:459:in `recognize!'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/dispatcher.rb:38:in `dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/fcgi_handler.rb:141:in `process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/fcgi_handler.rb:53:in `process!'
/usr/local/lib/ruby/gems/1.8/gems/fcgi- `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/fcgi- `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/fcgi_handler.rb:52:in `process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/fcgi_handler.rb:22:in `process!'

The net effect is the contents of the page are still rendered correctly, however, the style, images, and all scriptaculous features are lost.

I have raised a bug report with Rails Trac, number #3493

posted by David at 6:01 PM


Anonymous said...

temporary solution:
in /public/images and javascripts and stylesheets put a simple .htaccess with only
RewriteEngine Off

3:04 PM  

Post a Comment

Links to this post:

Create a Link

<< Home

Contact us

Previous Posts

links to this post

Powered by Blogger