Jump to content

IP Admit with HTTP Authentication Failover


bradcis

Recommended Posts

I have been looking around for this but haven't found a solution.

 

This is what I want to do. I want to setup a directory so that it will check if it matches my IP, if it does match my IP (the one inside .htaccess), then it will let me see the directory contents. However, if it doesn't match my IP, then (and only then) I want it to display the HTTP Authentication popup box.

 

The purpose of this is for me to be able to skip the login step if it someone is visiting from an authorized IP, otherwise, they will need to login to see the directory.

 

I know this can probably be done with PHP and such fairly easily, but I was really hoping to do this all through .htaccess. I plan on having wordpress, media wiki, a bug tracker, etc. in this directory (or sub directories of), so doing this with anything other than server configuration files would be painful.

 

Do you have any suggestions on how to go about doing this?

 

Thank you much in advance.

 

Brad

It can be done with ldap auth and password auth.

 

I took a look, at your query: limit by ip and password auth.

I think there might be a way, but not easy. It would involve a regex match. I.E. if !IP then password auth. There are still issues with that however.

 

You could always do:

 

/var/www/website

Create a symlink from /var/www/website to /var/www/website-ip

Then put in a rewrite rule based on IP. So anyone coming from the IP will be passed into the /var/www/website-ip directory, and as a result not have to enter a password.

Thats the method Id go with, on linux.

 

-steve

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.