Question

My roommate and I each have a separate webserver we are trying to set up. We are trying to use mod_proxy so that his server will forward requests to my machine (we have two seperate machines behind one router) based on the server name. I've given the basics of what we have in our apache config currently but we are getting a 403 Forbidden error when trying to access the second domain (the first, www domain, works fine).

NameVirtualHost *:80

<VirtualHost *:80>
 DocumentRoot /var/www
 ServerName www.<domain1>.com
</VirtualHost>

<VirtualHost *:80>
 ProxyPreserveHost On
 ProxyPass / http://<IP addr of other box>:80
 ProxyPassReverse / http://<IP addr of other box>:80
 ServerName <dummydomain>.gotdns.com
</VirtualHost>
Was it helpful?

Solution

Your mods-enabled/proxy.conf might be blocking any proxy requests (it's deny all by default). It should include the following instead:

ProxyRequests Off

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

EDIT: Also make sure that the mod_proxy submodules are sym linked into mods-enabled (in this case, the http sub module which is mods-available/proxy_http.load)

OTHER TIPS

Just put both routes:

<VirtualHost *:80>
    DocumentRoot "/app/"
    ProxyPreserveHost On
    ProxyRequests Off
    ServerName app.yourdomain.com

    ProxyPass /app http://yourIP:yourPort/app/
    ProxyPassReverse /app http://yourIP:yourPort/app/

    ProxyPass / http://yourIP:yourPort/app/
    ProxyPassReverse / http://yourIP:yourPort/app/
</VirtualHost>

<Location "/app/" >
    ProxyPass "http://yourIP:yourPort/app/"
    ProxyPassReverse  "http://yourIP:yourPort/app/"
    ProxyPassReverseCookiePath  "/app/"  "/app/"
    ProxyHTMLEnable Off
    ProxyHTMLExtended On
    ProxyHTMLURLMap "/app/" "/app/"
    Order allow,deny
    Allow from all
</Location>

This worked form me

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top