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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.