Page 1 of 1

Trouble with mod_proxy and mongrel_rails

Posted: 2010-03-28 21:17
by x3ro
Hey there

I'm trying to set up a mod_proxy - mongrel combination, but somehow, apache/mod_proxy is unable to access mongrel locally. The following is my configuration for mod_proxy:

Code: Select all

ProxyRequests Off
ProxyPreserveHost On

<Location />
        ProxyPass http://localhost:3000/
        ProxyPassReverse http://localhost:3000/
        Order deny,allow
        Allow from all
</Location>

Mongrel/Rails ist running just fine, because I can access it from my browser, and even with lynx on the server.

However, I get the following error when trying to use the proxy:

Code: Select all

[error] [client 127.0.0.1] Invalid Content-Length
I would appreciate any help :D

PS: Oh, and the server is running Plesk to configure vhosts, if thats important.

Re: Trouble with mod_proxy and mongrel_rails

Posted: 2010-03-28 22:54
by daemotron
Your ProxyPass directive is screwed. The correct statement for pass and reverse pass has to look like this:

Code: Select all

ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
In addition, you may need something like this in your vhost configuration:

Code: Select all

<Proxy *>
    Order Deny,Allow
    Allow from all
</Proxy>

Re: Trouble with mod_proxy and mongrel_rails

Posted: 2010-03-28 23:24
by x3ro
Hey there... :D

The Proxy directives were allright. When they're inside a <Location>, the location per proxy directive is not needed anymore.
I added the proxy section, and it still didn't work.
Then I tried starting the mongrel server with mongrel_rails start instead of "ruby script/server", and it magically started working...
Not sure what the difference is, though ;D

best regards,
x3ro

Re: Trouble with mod_proxy and mongrel_rails

Posted: 2010-03-28 23:38
by daemotron
x3ro wrote:Then I tried starting the mongrel server with mongrel_rails start instead of "ruby script/server", and it magically started working...
Not sure what the difference is, though ;D
Must be something with the HTTP headers. Perhaps it would be worth checking using nc or telnet... However, I had a mongrel server running behind an Apache proxy, and I used to start it by ruby script/server -e production. Weird...
x3ro wrote:The Proxy directives were allright. When they're inside a <Location>, the location per proxy directive is not needed anymore.
Didn't know that (and I admit I was to lazy to check it in the manual :oops: )
Btw. the <Proxy> stuff is only needed if you globally use it to deny Proxy stuff. Then you have to re-enable it on vhost level.