Jim Lum
2009-Jul-11 00:52 UTC
ActionController::RoutingError (Recognition failed for "/dis
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 -- Posted via http://www.ruby-forum.com/.
Jim Lum
2009-Jul-11 01:08 UTC
Re: 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, > JimHi, 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 -- Posted via http://www.ruby-forum.com/.
Frederick Cheung
2009-Jul-11 10:51 UTC
Re: ActionController::RoutingError (Recognition failed for "/dis
On Jul 11, 2:08 am, Jim Lum <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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/ 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> Jim > -- > Posted viahttp://www.ruby-forum.com/.
Jim Lum
2009-Jul-11 13:44 UTC
Re: ActionController::RoutingError (Recognition failed for "/dis
Frederick Cheung wrote:> On Jul 11, 2:08?am, Jim Lum <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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/ 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. > > FredFrederick, 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, 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 didn''t work http://myhost.com:3000/login/login didn''t work BUT: http://myhost.com:3000/login/ WORKED! i.e., when I set the IFRAME URL to "http://myhost.com:3000/login/", and access 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" ) 2) In public/index.html, I have: <iframe src ="http://myhost.com:3000/login/" height=100% width=100% frameborder="0"> <p>Your browser does not support iframes.</p> </iframe> 3) Then, when I access 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 -- Posted via http://www.ruby-forum.com/.