Forum: Ruby on Rails Recognition Failure

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
46b8b943879a960c3bc4a10e69a138f0?d=identicon&s=25 Floyd Resler (Guest)
on 2006-05-13 15:32
(Received via mailing list)
I keep getting a Recognition failed for "/dispatch.fcgi" error.  I
search for a solution and the closest I came to finding one was
someone saying "look at the Rewrite in .htaccess and you'll be able
to figure it out."  Well, I can't!  If anyone could help, I would
appreciate it.

Thanks!
Floyd
455ac2a64d06dc8461f4d258d7f7e980?d=identicon&s=25 Michael Trier (Guest)
on 2006-05-13 16:15
(Received via mailing list)
What does your .htaccess look like?  Maybe we can start there.  Also,
I assume you're running Apache.  Provide some more details.

Michael
46b8b943879a960c3bc4a10e69a138f0?d=identicon&s=25 Floyd Resler (Guest)
on 2006-05-13 17:26
(Received via mailing list)
Michael,
	You assume correctly.  I am running Apache 1.3 on Mac OS X 10.4
Server.  Here's my .htaccess file.  It's the default on that ruby
creates.

# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite
certain requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
#   RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
#   Alias /myrailsapp /path/to/myrailsapp/public
#   RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which
will be rendered instead
#
# Example:
#   ErrorDocument 500 /500.html

ErrorDocument 500 "<h2>Application error</h2>Rails application failed
to start properly"

Thanks!
Floyd
455ac2a64d06dc8461f4d258d7f7e980?d=identicon&s=25 Michael Trier (Guest)
on 2006-05-15 13:47
(Received via mailing list)
Any progress on this?  Are you running fastcgi or fcgid, or are you
just trying to use mod_ruby?  Generally I'll get the 500 error when
the permissions aren't right on the log and tmp directories.  The web
server needs to be able to write into both of these.

Michael
46b8b943879a960c3bc4a10e69a138f0?d=identicon&s=25 Floyd Resler (Guest)
on 2006-05-15 22:14
(Received via mailing list)
The tmp  and log directories are world writable.  I looked in the
development.log file and saw this towards the end:
ActionController::RoutingError (Recognition failed for "/
dispatch.fcgi"):
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/
action_controller/routing.rb:488:in `recognition_failed'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/
action_controller/routing.rb:478:in `recognize!'
     /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:
38:in `dispatch'
     /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/
fcgi_handler.rb:150:in `process_request'
     /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/
fcgi_handler.rb:54:in `process!'
     /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:600:in `each_cgi'
     /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi'
     /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/
fcgi_handler.rb:53:in `process!'
     /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/
fcgi_handler.rb:23:in `process!'
     /Users/macmage/Sites/maccrafters/guestbook/public/dispatch.fcgi:24

In the fastcgi.log file, I saw this:
[13/May/2006:20:07:58 :: 28217] asked to terminate immediately
[13/May/2006:20:07:58 :: 28217] terminated by explicit exit

Did you happen to notice anything amiss in my .htaccess file I
provided in my previous email?

Thanks for the help,
Floyd
455ac2a64d06dc8461f4d258d7f7e980?d=identicon&s=25 Michael Trier (Guest)
on 2006-05-15 22:51
(Received via mailing list)
Change this line:

RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

to

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

Everyone forgets that one.  You also don't need both handlers at the
top. Just the fcgi one.

Michael
46b8b943879a960c3bc4a10e69a138f0?d=identicon&s=25 Floyd Resler (Guest)
on 2006-05-15 23:46
(Received via mailing list)
Thanks, but I had already changed the rewrite rule and still no go.
I took out the additional handler and it still doesn't work.  I'm
sure it's something simple I'm missing.  I'm just not sure what!

Thanks!

Floyd
46b8b943879a960c3bc4a10e69a138f0?d=identicon&s=25 Floyd Resler (Guest)
on 2006-05-18 18:34
(Received via mailing list)
I got it figured out.  It was the RewriteBase line.  When I
uncommented it and changed the path, everything worked fine.

Floyd
This topic is locked and can not be replied to.