I want to restrict a staging server with basic auth, except for one special location, which should not have basic auth but be restricted to a client IP block.
My virtual host section looks like this:
DocumentRoot /var/www/vhosts/example/public
ServerName beta.example.com
<Directory /var/www/vhosts/example/public>
Options FollowSymLinks -MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<Location />
AuthUserFile /var/www/.htpasswd
AuthType Basic
AuthName "Secret"
Require valid-user
</Location>
<Location /payment/ipn>
# How can I disable basic auth here?
Order deny,allow
Deny from all
Allow from 216.113.191
</Location>
So, nobody should be able to access the site, unless they know the password. But the PayPal Sandbox (216.113.191.xxx) should be able to access http://beta.example.com/payment/ipn to send instant payment notifications.
I'm hosting Rails 3 via Passenger on Apache2.