Password protect apache vhost + reverse proxy

apache-2.2passwordreverse-proxyvirtualhost

I wish to create a password protected vhost for selected clients (clients.mysite.com)

We have a windows reverse proxy with some vhosts (www, static, secure). I am not using htaccess files as this is a reverse proxy and website is served by another back end server

How could I set up a password? I am using .conf files for our vhosts

Best Answer

I would imagine it could be done the same way you would protect a normal directory

<VirtualHost site:80>
    ServerName ...
    <Location /proxypath/>
        AuthType Basic
        AuthName "Restricted Files"
        AuthUserFile /usr/local/apache/passwd/passwords
        Require user rbowen
    </Location>

    ProxyPass /proxypath/ ...
</VirtualHost >

Then use the htpasswd utility to generate a .htpasswd file