Welcome Guest | Login

Apache reverse proxy not working with local mongrel

I am trying to set up apache+mongrel running on our VPS account and I'm totally stuck at getting mod_proxy working. Following the instructions here:
http://mongrel.rubyforge.org/docs/apache.html

I started Mongrel and can hit it directly (via port 8000) just fine. My Apache virtual host configuration looks like this:

<VirtualHost *>
 ServerName xxxxxx.com
 ServerAlias www.xxxxx.com

 ProxyRequests Off

 <Proxy *>
   Order deny,allow
   Allow from all
 </Proxy>

 ProxyPass / http://xx.xx.xx.xx:8000/
 ProxyPassReverse / http://xx.xx.xx.xx:8000/
#  ProxyPreserveHost on

 LogLevel debug

</VirtualHost>

I've tried my static IP address, the domain name, localhost, 127.0.0.1 -- in every case, the web browser gets a 503 error, and the Apache error log includes the following:

[Mon Feb 11 23:16:26 2008] [debug] mod_proxy_http.c(54): proxy: HTTP: canonicalising URL //xx.xx.xx.xx:8000/
[Mon Feb 11 23:16:26 2008] [debug] proxy_util.c(1336): [client yy.yy.yy.yy] proxy: http: found worker http://xx.xx.xx.xx:8000/ for http://xx.xx.xx.xx:8000/
[Mon Feb 11 23:16:26 2008] [debug] mod_proxy.c(777): Running scheme http handler (attempt 0)
[Mon Feb 11 23:16:26 2008] [debug] mod_proxy_http.c(1662): proxy: HTTP: serving URL http://xx.xx.xx.xx:8000/
[Mon Feb 11 23:16:26 2008] [debug] proxy_util.c(1697): proxy: HTTP: retrying the worker for (xx.xx.xx.xx)
[Mon Feb 11 23:16:26 2008] [debug] proxy_util.c(1703): proxy: HTTP: worker for (xx.xx.xx.xx) has been marked for retry
[Mon Feb 11 23:16:26 2008] [debug] proxy_util.c(1756): proxy: HTTP: has acquired connection for (xx.xx.xx.xx)
[Mon Feb 11 23:16:26 2008] [debug] proxy_util.c(1817): proxy: connecting http://xx.xx.xx.xx:8000/ to xx.xx.xx.xx:8000
[Mon Feb 11 23:16:26 2008] [debug] proxy_util.c(1913): proxy: connected / to xx.xx.xx.xx:8000
[Mon Feb 11 23:16:26 2008] [debug] proxy_util.c(2008): proxy: HTTP: fam 2 socket created to connect to xx.xx.xx.xx
[Mon Feb 11 23:17:11 2008] [error] (110)Connection timed out: proxy: HTTP: attempt to connect to xx.xx.xx.xx:8000 (67.228.132.192) failed
[Mon Feb 11 23:17:11 2008] [error] ap_proxy_connect_backend disabling worker for (xx.xx.xx.xx)
[Mon Feb 11 23:17:11 2008] [debug] proxy_util.c(1774): proxy: HTTP: has released connection for (xx.xx.xx.xx)

And yet, if I replace the proxy configuration with the following:

 ProxyPass / http://www.google.ca/
 ProxyPassReverse / http://www.google.ca/

that works fine! I see Google's web site under my domain.

Also, this same set up works on my own machine, running the same version of Ubuntu as is on our VPS.

So it seems like I'm missing some small but important detail or else something is broken. I've been at this for hours so I'd love to hear any ideas.

Thanks!

2008-02-11 05:33 PM

Hi there -

I see "Service Temporarily Unavailable" when accessing yuour site. Could you restart mongrel for t he app from it's document root ?
Also in the present Vhost set up, there no document root specified.

Also try changing the proxy directives as below.

<Proxy *>
  Order allow,deny
  Allow from all
</Proxy>

If you still have this issue, please email support so they can look more detail into this and walk you through the set up.

2008-02-11 07:06 PM

Re: Service Temporarily Unavailable, that's exactly the problem. Mongrel is running and can be hit at port 8000, but Apache can't proxy it for some reason. When it tries, it times out. Changing the proxy directive did nothing. Neither did rebooting the server.

I will open a ticket on this, as you suggest.

2008-02-11 09:19 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.