# Recognition Failure

**URL:** <https://www.ruby-forum.com/t/recognition-failure/60426>\
**Category:** Rails\
**Created:** [May 13, 2006, 3:32pm UTC](https://www.ruby-forum.com/t/recognition-failure/60426 "2006-05-13T15:32:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Floyd\_Resler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e36b37/32.png) [@Floyd\_Resler](https://www.ruby-forum.com/u/Floyd_Resler)\
**Post date:** [May 13, 2006, 3:32pm UTC](https://www.ruby-forum.com/t/recognition-failure/60426/1 "2006-05-13T15:32:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Floyd\_Resler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e36b37/32.png) [@Floyd\_Resler](https://www.ruby-forum.com/u/Floyd_Resler)\
**Post date:** [May 13, 2006, 4:15pm UTC](https://www.ruby-forum.com/t/recognition-failure/60426/2 "2006-05-13T16:15:41Z")

</div>

What does your .htaccess look like? Maybe we can start there. Also,  
I assume you’re running Apache. Provide some more details.

Michael

---

<div class="post-metadata">

**Author:** ![Floyd\_Resler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e36b37/32.png) [@Floyd\_Resler](https://www.ruby-forum.com/u/Floyd_Resler)\
**Post date:** [May 13, 2006, 5:26pm UTC](https://www.ruby-forum.com/t/recognition-failure/60426/3 "2006-05-13T17:26:00Z")

</div>

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 “

## Application error
Rails application failed  
to start properly”

Thanks!  
Floyd

---

<div class="post-metadata">

**Author:** ![Floyd\_Resler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e36b37/32.png) [@Floyd\_Resler](https://www.ruby-forum.com/u/Floyd_Resler)\
**Post date:** [May 15, 2006, 1:47pm UTC](https://www.ruby-forum.com/t/recognition-failure/60426/4 "2006-05-15T13:47:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Floyd\_Resler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e36b37/32.png) [@Floyd\_Resler](https://www.ruby-forum.com/u/Floyd_Resler)\
**Post date:** [May 15, 2006, 10:51pm UTC](https://www.ruby-forum.com/t/recognition-failure/60426/5 "2006-05-15T22:51:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Floyd\_Resler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e36b37/32.png) [@Floyd\_Resler](https://www.ruby-forum.com/u/Floyd_Resler)\
**Post date:** [May 15, 2006, 10:14pm UTC](https://www.ruby-forum.com/t/recognition-failure/60426/6 "2006-05-15T22:14:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Floyd\_Resler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e36b37/32.png) [@Floyd\_Resler](https://www.ruby-forum.com/u/Floyd_Resler)\
**Post date:** [May 15, 2006, 11:46pm UTC](https://www.ruby-forum.com/t/recognition-failure/60426/7 "2006-05-15T23:46:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Floyd\_Resler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/e36b37/32.png) [@Floyd\_Resler](https://www.ruby-forum.com/u/Floyd_Resler)\
**Post date:** [May 18, 2006, 6:34pm UTC](https://www.ruby-forum.com/t/recognition-failure/60426/8 "2006-05-18T18:34:34Z")

</div>

I got it figured out. It was the RewriteBase line. When I  
uncommented it and changed the path, everything worked fine.

Floyd
