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:
_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 ?