Setting up mod_proxy to pass http authentication to server

signpainter picture signpainter · Jun 2, 2011 · Viewed 41.9k times · Source

I have a problem configuring Apache as a proxy server. At the moment I access a MS Sharepoint installation using domain.net over Port 80. Before being able to use it I have to enter username and password. So far so good.

Now I want to be able to access a website over a subdomain web.domain.net. The Server hosting this site runs on another machine in the internal network. The solution I came up with is to redirect port 80 to the machine running apache to serve the new website and proxy any requests for the sharepoint to the sharepoint server.

So far I enabled all the proxy modules in my httpd.conf and added a virtual host. EDIT: Updated config after first responses.

<VirtualHost *:80>
    ServerName domain.net

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

    ProxyErrorOverride On
    ProxyPass   /   http://sharepoint/
    ProxyPassReverse   /   http://sharepoint/

    <Location />
        AuthType basic
        AuthBasicAuthoritative Off
        SetEnv proxy-chain-auth On
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

This works. Entering domain.net forwards me to the sharepoint server. Now comes the actually problem. The sharepoint asks me for my credentials. But when I enter them the login form keeps popping up as I entered no or incorrect username and password.

It seems like the credentials aren't forwarded to the sharepoint through the proxy.

Can you give me any advise how to solve this? Is it possible to do this using mod_proxy?

Answer

Femi picture Femi · Jun 2, 2011

See http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html: there is a proxy-chain-auth environmental variable that should forward the credentials on to the proxied server.