Topic : Using a .htaccess file to restrict access by IP address

Topic Archived This topic has been archived - replies are not allowed.


This question is answered. "Helpful" answers available: 2 . "Solved" answers available: 1 .



            Permlink
            Replies : 17 - Pages : 2 [ Previous | 1 2 ] - Last Post : Mar 23, 2006 7:21 PM by: Christopher Kam...
mickeyk

Posts: 10
Registered: Apr 5, 2005
Re: Using a .htaccess file to restrict access by IP address
Posted: Feb 24, 2006 7:20 AM   in response to: Roger Smith7
 

Yes, I was just allowing one IP address to access the folder as a test, what happens is that it denies all IP addresses, almost as though it doesn't pay attention to the allow line. I restarted Apache using the "start-stop service" in the server admin app. The Order Allow,Deny directive is in my sites.conf file, so that shouldn't be the cause of the problem. The mod_access module is enabled, I did this through the admin program and verified it in the terminal using pico. It looks as though everything is set up right, I was able to get this working on another computer running personal websharing without any problems, which is why I am wondering if there is a problem with Apache itself.

Mickey

   
Roger Smith7


Posts: 932
Registered: May 7, 2005
Re: Using a .htaccess file to restrict access by IP address
Posted: Feb 24, 2006 3:24 PM   in response to: mickeyk
 

Unfortunately, the stuff that Apple's done to Apache really makes the 1.3.x server a pain to setup. The 2.0 in /opt/apache* is much easier. If the directives are in the Directory directive, and apachectl restart was run, I can't explain why it isn't working. I'm sorry.

Roger

XServer   Mac OS X (10.4.3)   XRAID, Xasperated
Christopher Kam...

Posts: 1
Registered: Sep 16, 2005
Re: Using a .htaccess file to restrict access by IP address
Posted: Mar 23, 2006 7:21 PM   in response to: Roger Smith7
 

I've been pulling my hair out with this same problem.
I seemed to have solved it though. After searching a few boards for answers, here's what I've found:

1. Normal Apache Allow directives don't work. Due to the port swap REMOTE_ADDR always has the ip address of the server instead of the ip address of the user. The server returning the ip is the proxy server.

2. Turn off the performance cache in Server Admin -> Web -> Settings -> Sites -> Options

This acts as a proxy server in front of Apache to improve performance of certain files. However, one side effect is that Apache sees the IP address of the proxy server not the IP address of the user.

Performance cache or remote IP addresses. Pick one. You can't have both :)

In most cases, turning off the performance cache is what most people opt for. The performance gains are usually modest.

3. If you are hosting multiple sites, go to Server Admin and turn off performance caching on ALL of them. Turns out that if any sites are set to use it, then they all will!

Solved for me. Now I restrict access to a couple of directories to only on campus clients (UCSC). No one off campus can access.

Hope this helps