Reputation: 12480
Using the following .htaccess
, I am able to successfully limit access to users with the correct username/password and users from a specific IP address:
AuthType Basic
AuthName "Please enter your password"
AuthUserFile /path/to/.htpasswd
Require valid-user
Order deny,allow
Deny from all
Allow from 123.123.123.123
Satisfy Any
This works on a number of different servers, however, today I came across a server where this doesn't work 100%. Users with the correct username/password can login, but users from the specified IP are not allowed and are forced to enter a password.
Is there something in httpd.conf
that might be preventing the IP whitelist from working? I've tried a number of variations and continue to get the same result. All servers are Apache on Linux.
Upvotes: 4
Views: 3555
Reputation: 710
To do the job and allow from IP without password prompt, and also allow from any address with password prompt, it work perfect like this :
Order deny,allow
Deny from all
AuthName "password please"
AuthUserFile /home/accountpath/.htpasswd
AuthType Basic
Require valid-user
Allow from 192.168.1.1
Satisfy Any
Upvotes: 5