ActionController::RoutingError (Recognition failed for "/dis

Jim Lum 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.

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,
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
instead of having to use 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,
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:

<iframe src ="http://myhost.com:3000/dispatch.fcgi" height=100%
width=100% frameborder="0">
  <p>Your browser does not support iframes.</p>
</iframe>

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

<iframe src ="http://myhost.com:3000" height=100% width=100%
frameborder="0">
  <p>Your browser does not support iframes.</p>
</iframe>

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:

<iframe src ="http://myhost.com:3000/dispatch.fcgi" height=100%
width=100% frameborder="0">
  <p>Your browser does not support iframes.</p>
</iframe>

Jim

> 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/ to something explicit (eg http://myhost.com:3000/home,
assuming you have a HomeController or 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