Mongrel/WEBrick Forwarding in Apache

This will let you redirect an apache request to a local mongrel or webrick server. Very handy, yet maybe some logging of the used ports would be good at some point.


<VirtualHost collaboa.example.com:80>
  Servername collaboa.example.com
  CustomLog /www/collaboa/logs/access.log combined
  ErrorLog  /www/collaboa/logs/error.log
        ProxyPass / http://127.0.0.1:3005/
        ProxyPassReverse / http://127.0.0.1:3005/
</VirtualHost>



Comments

  1. bryce

    June 14, 2006 at 2:55 AM

    I tried using this for a public-facing server (which is probably a huge mistake in its own right). I ran into two major issues.

    First, you have to remember to have mod_proxy running on your server.

    Second, to define permissions, you have to add a directive like:

    <Proxy http://127.0.0.1:3000&gt;
    Order allow,deny
    allow from all
    </Proxy>

    At least, that did it for me. Without that directive, you’ll get nothing but 403 forbiddens, which can only entertain you for so long.


  2. bryce

    June 14, 2006 at 2:55 AM

    &lt;Proxy http://127.0.0.1:3000&gt;
    Order allow,deny
    allow from all
    &lt;/Proxy&gt;

    Sorry. Should have previewed.


  3. Andy

    June 14, 2006 at 2:55 AM

    I searched hours and hours to find a solution for my apache2, suse 9.3, plesk VPS. I matched tons of tutorials how to build this with lighttpd or from the bottom of a new installation. So this saved me and i want to thank you a lot :)

    P.S. for some reasons i donĀ“t know, my rails – mongrel – apache – proxy works without that directive. I have mod_proxy installed but no directive. Do you have any suggestions why this works also ?

    best wishes

    Andy


  4. Hank

    June 14, 2006 at 2:55 AM

    Andy,
    What directive do you mean?