apache proxy module gives 403 forbidden error

naiquevin picture naiquevin · Aug 19, 2010 · Viewed 22.2k times · Source

I am trying to use the apache's proxy module for working with xmpp on ubuntu desktop. For this i did the following things -

1) enabled mod_proxy by creating a symlink of proxy.conf, proxy.load and proxy_http.load from /etc/apache2/mods-available/ in the mods-enabled directory.

2) Added the following lines to the vhost

    <Proxy http://mydomain.com/httpbind>
     Order allow,deny
     Allow from all
   </Proxy>

   ProxyPass /httpbind http://mydomain.com:7070/http-bind/
   ProxyPassReverse /httpbind http://mydomain.com:7070/http-bind/

I am new to using the proxy module but what i can make from the above lines is that requests to http://mydomain.com/httpbind will be forwarded to http://mydomain.com:7070/http-bind/. Kindly correct if wrong.

3) added rule Allow from .mydomain.com in /mods-available/proxy.conf

Now i try to access http://mydomain.com/httpbind and it shows 403 Forbidden error..

What am i missing here ? Please help. thanks

Edit : The problem got solved when i changed the following code in mods_available/proxy.conf

    <Proxy *>
            AddDefaultCharset off
            Order deny,allow
    Deny from all 
    Allow from mydomain.com                        
    </Proxy>

to

    <Proxy *>
            AddDefaultCharset off
            Order deny,allow
    #Deny from all 
    Allow from all                         
    </Proxy>

Didnt get what was wrong with the initial code though

Answer

Alex picture Alex · Oct 4, 2012

I know this is an old question, but I came accross it in a google search. Just a quick explaination of why the code didn't work initially.

In your proxy definition, you define "Order deny,allow". This means that deny statements will take precedence over allow statements. You had "Deny from all" in your config. As this takes precedence, it doesn't matter if you have "allow from all", it would still deny all.