Forward proxy user authentication does not work

apache-2.2authenticationconfigurationforwardingPROXY

I have got a simple forward proxy that needs to have user authentication and a whitelist of IP-adresses. I have created the vhost below:

ProxyRequests On
ProxyVia On

<Proxy xx.xxx.xx.xxx:8888>
   Order deny,allow
   Allow from xx.xxx.xx.xxx
   Allow from xx.xxx.xx.xxx
   Allow from xx.xxx.xx.xxx
   Allow from xx.xxx.xx.xxx

   AuthType Basic
   AuthName "Password Required for Proxy"
   AuthUserFile /etc/apache2/.proxyhtpasswd
   Require user
</Proxy>

The proxy itself works fine, but the user authentication and allowing IP's however does not. I changed the config 10 times and even with only the Auth block in there it still works without having to use a (valid) user/password or having the correct IP-adress.

I also tried to configure this through a normal VirtualHost config and still no success:

<VirtualHost xx.xxx.xx.xxx:8888>
    ProxyRequests On
    ProxyVia On
    SSLProxyEngine On

    <Location />
        Order Deny,Allow
        Deny from all
        Allow from xx.xxx.xx.xxx
        Allow from xx.xxx.xx.xxx
        Allow from xx.xxx.xx.xxx
        Allow from xx.xxx.xx.xxx

        AuthType Basic
        AuthBasicProvider file
        AuthName "Password Required for Proxy"
        AuthUserFile /etc/apache2/.proxyhtpasswd
        Require valid-user
    </Location>
</VirtualHost>

Best Answer

I think it is either

Require valid-user

or

Require user [theusername]

but not

Require user

See: http://httpd.apache.org/docs/current/mod/core.html#require

Related Topic