Apache Proxy for Rails Returns 403 Forbidden

Trying to set up Apache2 as a proxy for mongrel on my new Ruby on Rails server, following the instructions on the mongrel site. I kept getting “403 Forbidden” errors on every request. I found a comment that seemed to describe the same situation. Sure enough, editing /etc/apache2/mods-enabled/proxy.conf to change “Deny” to “Allow” fixed the problem. I kept ProxyRequests turned off, which is supposed to prevent my site from becoming an open proxy, but I’m still nervous about removing that “Deny” directive. I wish there were a more authoritative source of information on this.

This entry was posted in Programming and tagged . Bookmark the permalink.

3 Responses to Apache Proxy for Rails Returns 403 Forbidden

  1. Tony Perrie says:

    Here is my configuration:

    ServerName ninjarailsapp.com:80
    ProxyRequests Off
    ProxyPreserveHost On
    RewriteEngine On
    RewriteRule ^/(.*) http://127.0.0.1:4000/$1 [P,L]
    ProxyPassReverse / http://127.0.0.1:4000/
    ErrorLog logs/ninja_error_log
    CustomLog logs/ninja_access_log combined

  2. Tony Perrie says:

    Bah, forgot to escape less-than and greater-than:


    <VirtualHost *:80>
    ServerName ninjarailsapp.com:80
    ProxyRequests Off
    ProxyPreserveHost On
    RewriteEngine On
    RewriteRule ^/(.*) http://127.0.0.1:4000/$1 [P,L]
    ProxyPassReverse / http://127.0.0.1:4000/
    ErrorLog logs/ninja_error_log
    CustomLog logs/ninja_access_log combined
    </VirtualHost>

  3. Chris Godwin says:

    A more authoritative source? Ahem, http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>