# ActionController::RoutingError (Recognition failed for "/dis

**URL:** <https://www.ruby-forum.com/t/actioncontroller-routingerror-recognition-failed-for-dis/171903>\
**Category:** Rails\
**Created:** [July 11, 2009, 2:52am UTC](https://www.ruby-forum.com/t/actioncontroller-routingerror-recognition-failed-for-dis/171903 "2009-07-11T02:52:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimlast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@jimlast](https://www.ruby-forum.com/u/jimlast)\
**Post date:** [July 11, 2009, 2:52am UTC](https://www.ruby-forum.com/t/actioncontroller-routingerror-recognition-failed-for-dis/171903/1 "2009-07-11T02:52:41Z")

</div>

Hi,

I’m just getting started with Ruby on Rails, and I’m having to make some  
modifications to an existing system and RoR app that uses lighttpd with  
the RoR web app.

Basically, what I’m trying to do is somehow add a header area to all the  
web app pages. Since this RoR is part of a 3rd party product (“COTS”),  
I’m not able to change any of the Ruby/RoR code, so what I’m trying to  
do is use an HTML page with an IFRAME, where the IFRAME URL points to  
the RoR web app.

With the original configuration, the RoR web app was accessed using URL  
[http://myhost.com:3000](http://myhost.com:3000).

So, what I initially did was put a test HTML page (public/test.html) in  
the public directory, and when I go to [http://myhost.com:3000/test.html](http://myhost.com:3000/test.html),  
it worked, i.e., I get a page with my header with the RoR web app  
content below the header.

Once that was working, I wanted to tweak the lighttpd configuration so  
that I could access _my_ HTML page using the URL [http://myhost.com:3000](http://myhost.com:3000)  
instead of having to use [http://myhost.com:3000/test.html](http://myhost.com:3000/test.html).

To try to do this, I renamed my public/test.html file to  
public/index.html, and then changed the server.indexfiles parameter in  
the lighttpd.conf from:

server.indexfiles = ( “dispatch.fcgi”, “index.html” )

to:

server.indexfiles = ( “index.html”, “dispatch.fcgi” )

(i.e., I reversed the order so that “index.html” would be found first,  
ahead of “dispatch.fcgi”).

However, after bouncing lighttpd, when I access [http://myhost.com:3000](http://myhost.com:3000),  
I get a page with my header stuff, and under that a “File not found”.

The lighttpd error log file doesn’t show any errors, but in  
production.log, I see:

ActionController::RoutingError (Recognition failed for  
“/dispatch.fcgi”):

Quite frankly, I don’t know if this is some problem in the lighttpd  
configuration, or with RoR, but the error in production.log above seems  
to indicate, I think, that Rails can’t find the public/dispatch.fcgi,  
but that file is definitely there, so I’ve been stumped by this :(…

Can anyone tell me what might be wrong, and how to get this working?

Thanks in advance,  
Jim

---

<div class="post-metadata">

**Author:** ![jimlast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@jimlast](https://www.ruby-forum.com/u/jimlast)\
**Post date:** [July 11, 2009, 3:08am UTC](https://www.ruby-forum.com/t/actioncontroller-routingerror-recognition-failed-for-dis/171903/2 "2009-07-11T03:08:45Z")

</div>

Jim L. wrote:

> Hi,
> 
> I’m just getting started with Ruby on Rails, and I’m having to make some  
> modifications to an existing system and RoR app that uses lighttpd with  
> the RoR web app.
> 
> Basically, what I’m trying to do is somehow add a header area to all the  
> web app pages. Since this RoR is part of a 3rd party product (“COTS”),  
> I’m not able to change any of the Ruby/RoR code, so what I’m trying to  
> do is use an HTML page with an IFRAME, where the IFRAME URL points to  
> the RoR web app.
> 
> With the original configuration, the RoR web app was accessed using URL  
> [http://myhost.com:3000](http://myhost.com:3000).
> 
> So, what I initially did was put a test HTML page (public/test.html) in  
> the public directory, and when I go to [http://myhost.com:3000/test.html](http://myhost.com:3000/test.html),  
> it worked, i.e., I get a page with my header with the RoR web app  
> content below the header.
> 
> Once that was working, I wanted to tweak the lighttpd configuration so  
> that I could access _my_ HTML page using the URL [http://myhost.com:3000](http://myhost.com:3000)  
> instead of having to use [http://myhost.com:3000/test.html](http://myhost.com:3000/test.html).
> 
> To try to do this, I renamed my public/test.html file to  
> public/index.html, and then changed the server.indexfiles parameter in  
> the lighttpd.conf from:
> 
> server.indexfiles = ( “dispatch.fcgi”, “index.html” )
> 
> to:
> 
> server.indexfiles = ( “index.html”, “dispatch.fcgi” )
> 
> (i.e., I reversed the order so that “index.html” would be found first,  
> ahead of “dispatch.fcgi”).
> 
> However, after bouncing lighttpd, when I access [http://myhost.com:3000](http://myhost.com:3000),  
> I get a page with my header stuff, and under that a “File not found”.
> 
> The lighttpd error log file doesn’t show any errors, but in  
> production.log, I see:
> 
> ActionController::RoutingError (Recognition failed for  
> “/dispatch.fcgi”):
> 
> Quite frankly, I don’t know if this is some problem in the lighttpd  
> configuration, or with RoR, but the error in production.log above seems  
> to indicate, I think, that Rails can’t find the public/dispatch.fcgi,  
> but that file is definitely there, so I’ve been stumped by this :(…
> 
> Can anyone tell me what might be wrong, and how to get this working?
> 
> Thanks in advance,  
> Jim

Hi,

I forgot to mention that at the same time I modified the lighttpd.conf,  
I modified the index.html so that it has an IFRAME that looks like this:

In other words, with the original lighttpd.conf, where dispatch.fcgi was  
first, my original test.html had:

but, when I changed the lighttpd.conf so that index.html was first, I  
copied test.html to index.html and changed the IFRAME to:

Jim

---

<div class="post-metadata">

**Author:** ![jimlast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@jimlast](https://www.ruby-forum.com/u/jimlast)\
**Post date:** [July 11, 2009, 12:51pm UTC](https://www.ruby-forum.com/t/actioncontroller-routingerror-recognition-failed-for-dis/171903/3 "2009-07-11T12:51:53Z")

</div>

On Jul 11, 2:08 am, Jim L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Quite frankly, I don’t know if this is some problem in the lighttpd  
> > configuration, or with RoR, but the error in production.log above seems  
> > to indicate, I think, that Rails can’t find the public/dispatch.fcgi,  
> > but that file is definitely there, so I’ve been stumped by this :(…
> 
> > Can anyone tell me what might be wrong, and how to get this working?

It’s been a long time since I have used any of the dispatch.fcgi ways  
of deploying rails but you don’t want to link directly to that file.  
What’s happening is that lighthttpd is loading up dispatch.fcgi and  
then telling rails that it should handle the url /dispatch.fcgi which  
makes no sense to rails. If you change the iframe source from  
[http://myhost.com:3000/](http://myhost.com:3000/) to something explicit (eg  
[http://myhost.com:3000/home](http://myhost.com:3000/home),  
assuming you have a HomeController or [http://myhost.com:3000/home.html](http://myhost.com:3000/home.html)  
assuming you have home.html in your public folder and lighthttpd is  
setup to serve static files for you)

Alternatively It might be easier to just have the rails part on a  
different vhost.

Lastly, I’m still not sure why using an application layout or  
something like that wouldn’t be an easier way to do this.

Fred

---

<div class="post-metadata">

**Author:** ![jimlast](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@jimlast](https://www.ruby-forum.com/u/jimlast)\
**Post date:** [July 11, 2009, 3:44pm UTC](https://www.ruby-forum.com/t/actioncontroller-routingerror-recognition-failed-for-dis/171903/4 "2009-07-11T15:44:10Z")

</div>

Frederick C. wrote:

> On Jul 11, 2:08?am, Jim L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > > Quite frankly, I don’t know if this is some problem in the lighttpd  
> > > configuration, or with RoR, but the error in production.log above seems  
> > > to indicate, I think, that Rails can’t find the public/dispatch.fcgi,  
> > > but that file is definitely there, so I’ve been stumped by this :(…
> > 
> > > Can anyone tell me what might be wrong, and how to get this working?
> 
> It’s been a long time since I have used any of the dispatch.fcgi ways  
> of deploying rails but you don’t want to link directly to that file.  
> What’s happening is that lighthttpd is loading up dispatch.fcgi and  
> then telling rails that it should handle the url /dispatch.fcgi which  
> makes no sense to rails. If you change the iframe source from  
> [http://myhost.com:3000/](http://myhost.com:3000/) to something explicit (eg  
> [http://myhost.com:3000/home](http://myhost.com:3000/home),  
> assuming you have a HomeController or [http://myhost.com:3000/home.html](http://myhost.com:3000/home.html)  
> assuming you have home.html in your public folder and lighthttpd is  
> setup to serve static files for you)
> 
> Alternatively It might be easier to just have the rails part on a  
> different vhost.
> 
> Lastly, I’m still not sure why using an application layout or  
> something like that wouldn’t be an easier way to do this.
> 
> Fred

Frederick,

THANKS! You’re _BRILLIANT_!!

I can serve static content, but the RoR web app also has a login  
controller (“login”).

So, I first tested with [http://myhost.com:3000/login](http://myhost.com:3000/login), and I was able to  
get the login page (albeit without my header stuff).

So then, I started tweaking the IFRAME URL in my index.html.

[http://myhost.com:3000/login](http://myhost.com:3000/login) didn’t work  
[http://myhost.com:3000/login/login](http://myhost.com:3000/login/login) didn’t work

BUT:

[http://myhost.com:3000/login/](http://myhost.com:3000/login/) WORKED!

i.e., when I set the IFRAME URL to “[http://myhost.com:3000/login/](http://myhost.com:3000/login/)”, and  
access [http://myhost.com:3000](http://myhost.com:3000), I get the RoR web app with my header  
stuff!!

COOL!!

To summarize, here’s what I did:

1. In lighttpd.conf, I modified “server.indexfiles” to:

server.indexfiles = ( “index.html” )

1. In public/index.html, I have:

1. Then, when I access [http://myhost.com:3000](http://myhost.com:3000), I get the original RoR  
web app, with my header stuff.

I’m really new to both lighty and RoR, so I guess I don’t quite  
understand a lot of this (yet!), but I’m glad that it’s working :)!!

Thanks for your help!

Jim
