How to exclude a specific URL from basic authentication in Apache?

Posted by ripper234 on Server Fault See other posts from Server Fault or by ripper234
Published on 2012-03-21T11:23:56Z Indexed on 2012/03/21 11:31 UTC
Read the original article Hit count: 296

Filed under:
|

Two scenarios:

Directory

I want my entire server to be password-protected, so I included this directory config in my sites-enabled/000-default:

<Directory />
  Options FollowSymLinks
  AllowOverride None
  AuthType Basic
  AuthName "Restricted Files"
  AuthUserFile /etc/apache2/passwords
  Require user someuser
</Directory>

The question is how can I exclude a specific URL from this?

Proxy

I found that the above password protection doesn't apply to mod_proxy, so I added this to my proxy.conf:

<Proxy *>
  Order deny,allow
  Allow from all

  AuthType Basic
  AuthName "Restricted Files"
  AuthUserFile /etc/apache2/passwords
  Require user someuser
</Proxy>

How do I exclude a specific proxied URL from the password protection? I tried adding a new segment:

<Proxy http://myspecific.url/>
  AuthType None
</Proxy>

but that didn't quite do the trick.

© Server Fault or respective owner

Related posts about httpd

Related posts about mod-proxy