Greetings all-- I recently installed Ruby and Rails on a third-party server--my webhost account--in order to run a Rails application called Tracks. I''m having problems with Tracks that I can''t be certain aren''t actually problems with Rails. I''ve installed the most current versions of Ruby, Rake, RubyGems, and Rails (as of yesterday) in /home/bar.com/usr. Rails is working well enough to create new applications. The problem is that I''m unable to get the Tracks app to respond properly when I hit it over the web. Hitting the startup URL foo.bar.com/dispatch.cgi?controller=login&action=signup produces the following error in my error log: Processing Base#signup (for [IP address] at Tue Mar 29 16:10:40 PST 2005) Parameters: {"action"=>"signup", "controller"=>"login"} ActionController::RoutingError (No route for path: "dispatch.cgi"): /home/bar.com/usr/lib/ruby/gems/1.8/gems/actionpack-1.7.0/lib/action_control ler/routing.rb:287:in `recognize!'' /home/bar.com/usr/lib/ruby/gems/1.8/gems/rails-0.11.1/lib/dispatcher.rb:32:i n `dispatch'' dispatch.cgi:10 Does this suggest an obvious answer? Or, if not, some obvious questions? Tracks seems to work well enough for many other folks, both those who use it on their own servers and those who have, like me, installed it on third-party hosts. Other pieces of information that may or not be relevant: * The server is running Apache on Linux. * My webhost automatically provides subdomains for any directory inside the root /home/bar.com/html directory. I have a vague recollection of seeing, somewhere, somebody mention that this auto-subdomain trick may cause problems with Ruby or Rails on external hosts. But I can''t seem to find it again, so I may be misremembering things. * I''m also having difficulty with my .htaccess file--the RewriteRules don''t seem to be working at the moment. This seemed like a secondary issue so for now I''m routing around the problem by using dispatch.cgi?controller=login&action=signup rather than just foo.bar.com/login/signup. The ''short form'' just gives me the 404 page, without any error being logged at all. No idea if the issues might be related. My undying gratitude to anybody who can help me shed some light on the situation.
On Wed, 30 Mar 2005 05:00:00 GMT, Andrew Willett <rails-LubOGBy5Ou8Ud+WwKJZ6pFaTQe2KTcn/@public.gmane.org> wrote:> Hitting the startup URL > foo.bar.com/dispatch.cgi?controller=login&action=signup produces the > following error in my error log: > Processing Base#signup (for [IP address] at Tue Mar 29 16:10:40 PST 2005) > Parameters: {"action"=>"signup", "controller"=>"login"} > > ActionController::RoutingError (No route for path: "dispatch.cgi"):That makes perfect sense.> Does this suggest an obvious answer? Or, if not, some obvious questions? > Tracks seems to work well enough for many other folks, both those who use it > on their own servers and those who have, like me, installed it on > third-party hosts.Rails URL parsing is a little simplistic. When you request dispatch.cgi file, rails things you want the "dispatch.cgi" controller, which does not exist. So you have to make a way to get "dispatch.cgi" out of your URL. If you''re using apache, the default .htaccess that comes with rails does this for you. Just visit foo.bar.com/login/signup and it will work fine. If you''re using a different web server, tell us what it is and somebody should be able to help you with that.> Other pieces of information that may or not be relevant: > * The server is running Apache on Linux.Ok, you''ve answered my question then (that''s what I get for not reading the full email before starting typing).> * I''m also having difficulty with my .htaccess file--the RewriteRules don''t > seem to be working at the moment. This seemed like a secondary issue so for > now I''m routing around the problem by using > dispatch.cgi?controller=login&action=signup rather than just > foo.bar.com/login/signup. The ''short form'' just gives me the 404 page, > without any error being logged at all. No idea if the issues might be > related.Uh... ok. So... well you''re gonna need to fix those rewrite rules then. -- Urban Artography http://artography.ath.cx
On Wednesday 30 March 2005 00:33, Rob Park wrote:> Uh... ok. So... well you''re gonna need to fix those rewrite rules then.It seems to me like apache might be ignoring your htaccess, or perhaps you have an old version of the htaccess. I suggest you make sure htaccess is at it''s newest. If you''re using a recent version of rails, just run $ rails . when in your app''s folder. Skip all changes except .htaccess, which you should overwrite. -- Nicholas Seckar aka. Ulysses
Rob Park writes:> Rails URL parsing is a little simplistic. When you request > dispatch.cgi file, rails things you want the "dispatch.cgi" > controller, which does not exist. So you have to make a way to get > "dispatch.cgi" out of your URL. If you''re using apache, the default > .htaccess that comes with rails does this for you. Just visit > foo.bar.com/login/signup and it will work fine. > [snip] > Uh... ok. So... well you''re gonna need to fix those rewrite rules then.Just to be sure I understand things here--the problem is that (a) Rails needs the URL as I typed it to be in the shorthand /login/signup to function properly, so (b) I have to use .htaccess rewrites to hit the full URL, rather than hitting it directly? Thanks for helping out the n00b. A
I rewrote the .htaccess as you described, and hit bar.foo.com/login/signup. Now I get: Internal Server Error [...] Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. Oddly, something that happens when using the default rewrites trumps the /500.html declaration in the .htaccess file. On the other hand, the RewriteRules I had been using get me the 404 page as declared in .htaccess. I guess I''m still stumped. Both sets of rewrites are below, in case anybody feels like taking a look to try to identify the trouble. Regardless, thanks for your help. Andy DEFAULT SET RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ dispatch.cgi [QSA,L] CUSTOM SET RewriteRule ^/$ /dispatch.cgi?controller=todo&action=list [QSA,L] RewriteRule ^/([\-_a-zA-Z0-9]+)$ /dispatch.cgi?$1 [QSA,L] RewriteRule ^/([\-_a-zA-Z0-9]+)/([\-_a-zA-Z0-9]+)\?(.*) /dispatch.cgi?controller=$1&action=$2&$3 [QSA,L] RewriteRule ^/([\-_a-zA-Z0-9]+)/([\-_a-zA-Z0-9]+)/([\-_a-zA-Z0-9%]+)$ /dispatch.cgi?controller=$1&action=$2&id=$3 [QSA,L] RewriteRule ^/([\-_a-zA-Z0-9]+)/([\-_a-zA-Z0-9]+)$ /dispatch.cgi?controller=$1&action=$2 [QSA,L] On Mar 30, 2005, at 12:46 AM, Nicholas Seckar wrote:> On Wednesday 30 March 2005 00:33, Rob Park wrote: >> Uh... ok. So... well you''re gonna need to fix those rewrite rules >> then. > > It seems to me like apache might be ignoring your htaccess, or perhaps > you > have an old version of the htaccess. I suggest you make sure htaccess > is at > it''s newest. If you''re using a recent version of rails, just run > > $ rails . > when in your app''s folder. Skip all changes except .htaccess, which > you should > overwrite. > > -- > > Nicholas Seckar aka. Ulysses