IP forwarding with .htaccess / .htpasswd

Using the following .htaccess

, I can successfully restrict access to users with the correct username / password and users from a specific IP:

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 several different servers, however I ran into a server today where it doesn't work 100%. Users with the correct username / password can log in, but users from the specified IP address are denied and forced to enter the password.

Is there something in httpd.conf

that might interfere with IP whitelisting? I have tried several options and keep getting the same result. All Apache servers on Linux.

+3


source to share


1 answer


To complete the job and resolve it using IP without password prompt, and also resolve any address using password, it works 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

      

+4


source







All Articles