Ralph Shnelvar
2010-Dec-01 17:01 UTC
Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
I just installed my RoR application on my ISP''s server. This is a Cpanel environment and it creates a .htaccess file: RewriteEngine on RewriteCond %{HTTP_HOST} ^xyz.com$ [OR] RewriteCond %{HTTP_HOST} ^www.xyz.com$ RewriteRule ^(.*)$ "http\:\/\/127\.0\.0\.1\:12001\/$1" [P,L] in a public_html directory. (I changed my domain name in the text above to xyz because we are not ready to do a product launch.) The objective, I guess, of the .htaccess file in public_html is to rewrite (i.e. redirect) www.xyz.com to 127.0.0.1:12001 When I access my website using www.xyz.com:12001 everything works fine. All my pictures show up, all links work, there are no errors in production.log and the only error I see in mongrel.log is Rails signals registered. HUP => reload (without restart). It might not work well. But that message only occurs during mongrel startup. When I attempt to access my website via www.xyz.com or xyz.com I get a ton of mongrel errors complaining that HTTP parse error, malformed request (127.0.0.1): #<Mongrel::HttpParserError: Invalid HTTP format, parsing fails.> REQUEST DATA: "GET /images/Logo 010 - 200x48 - no background.png?1289857922 HTTP/1.1\r\nHost: 127.0.0.1:12001\r\nUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; .NET4.0E)\r\nAccept: image/png,image/*;q=0.8,*/*;q=0.5\r\nAccept-Language: en-us,en;q=0.5\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\nReferer: http://www.xyz.com/\r\nCookie: _XYZ_session=BAh7BjoPc2Vzc2lvbl9pZCIlOTZlZTVmMjUxOGE3YmIwMGEzNTQ5M2QzZDYwMDI4NmE%3D--fbeb1fb7b16f82da9485523bb84ad3b60fd8d6dc\r\nMax-Forwards: 10\r\nX-Forwarded-For: 98.245.93.82\r\nX-Forwarded-Host: www.xyz.com\r\nX-Forwarded-Server: xyz.com\r\n\r\n" --- PARAMS: {"REQUEST_PATH"=>"/images/Logo", "REQUEST_URI"=>"/images/Logo", "REQUEST_METHOD"=>"GET"} - - - - - - - - - I don''t even know where to begin to look to solve this problem so I would appreciate any pointers. Am I missing some route.rb statement that needs to handle 127.0.0.1:12001 ? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Dec-01 17:07 UTC
Re: Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
On Wed, Dec 1, 2010 at 9:01 AM, Ralph Shnelvar <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> HTTP parse error, malformed request (127.0.0.1): > #<Mongrel::HttpParserError: Invalid HTTP format, parsing fails.> > > REQUEST DATA: "GET /images/Logo 010 - 200x48 - no > background.png?1289857922> PARAMS: {"REQUEST_PATH"=>"/images/Logo", "REQUEST_URI"=>"/images/Logo", > "REQUEST_METHOD"=>"GET"}OMG. Do you actually have spaces in your image file names? -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ralph Shnelvar
2010-Dec-01 17:25 UTC
Re: Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
> OMG. Do you actually have spaces in your image file names? > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassanYes ... why not? I have not had any troubles with spaces in file names on my Windows development environment, Linux static web page environment, or Linux RoR environment. What''s the issue? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2010-Dec-01 17:35 UTC
Re: Re: Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
On Wed, Dec 1, 2010 at 9:25 AM, Ralph Shnelvar <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have not had any troubles with spaces in file names on my Windows > development environment, Linux static web page environment, or Linux RoR > environment. > > What''s the issue?You just found it -- or at least one -- apparently :-) Spaces in file or directory names are brittle -- some programs will handle them OK, some won''t. You''re far better off avoiding them. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Lee Davis
2010-Dec-01 17:35 UTC
Re: Re: Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
On Dec 1, 2010, at 12:25 PM, Ralph Shnelvar wrote:> Yes ... why not? > > I have not had any troubles with spaces in file names on my Windows > development environment, Linux static web page environment, or Linux > RoR > environment. > > What''s the issue?A URL must not contain spaces, which is why browsers will silently fill in %20 to replace them whenever they encounter a badly-coded URL. Seriously, deep in the bowels of the Internet World Domination Headquarters, Tim Berners-Lee kills a kitten each time you put spaces in a URL. Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Rob Biedenharn
2010-Dec-01 17:38 UTC
Re: Re: Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
On Dec 1, 2010, at 12:25 PM, Ralph Shnelvar wrote:>> OMG. Do you actually have spaces in your image file names? >> >> -- >> Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org >> twitter: @hassan > > Yes ... why not? > > I have not had any troubles with spaces in file names on my Windows > development environment, Linux static web page environment, or Linux > RoR > environment. > > What''s the issue?The issue isn''t really the filenames directly, but that URLs cannot contain spaces. Depending on where the space occurs, it should be encoded either as %20 (in the path portion) or as + (in the query- string portion). In my experience, even using + rather than %20 in path components (such as your filename) will work properly even though it might not be strictly correct per some RFC. -Rob Rob Biedenharn Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org http://AgileConsultingLLC.com/ rab-/VpnD74mH8+00s0LW7PaslaTQe2KTcn/@public.gmane.org http://GaslightSoftware.com/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ralph Shnelvar
2010-Dec-01 19:23 UTC
Re: Re: Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
>> What''s the issue? > > The issue isn''t really the filenames directly, but that URLs cannot > contain spaces.[snip]> > -RobRob and Hassan and all ... I don''t believe it ... but you were right. Replacing the spaces with hyphens every and ... everything works. Wow. I thought I was chasing a wild good but instead I found the goose that lays the HTML eggs. Thanks!!!! Ralph -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.