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.

3 thoughts on “Apache Proxy for Rails Returns 403 Forbidden”

  1. 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. 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>

Comments are closed.