[wplug] Apache question

Joe Topjian joe at portsys.net
Tue Sep 9 10:29:26 EDT 2003


> Is there any way to limit the amount of connections to specific 
> folders under Apache?
>
> For example, if I have a folder on my webserver named "downloads" and 
> I wanted to limit access to this folder and this folder only so that 
> only 3 people could be downloading something from this folder at any 
> given time, could I do that?
>
> Furthermore, if I can do the above, can I set up a custom error 
> document  to explain that "there are too many connections, please try 
> back in a minute"?   (I ask, because want to make sure they can still 
> connect to the webserver and get the error document, and not just be 
> refused a connection outright.)

HTTP is a stateless protocol, so its pretty hard to keep track of who's 
connected when. At first, I thought if 3 people are downloading a 
pretty big file, apache should be keeping track that there are 3 open 
connections. But I couldnt find any apache directive or module that 
would track that. The closest I came to was this:

http://www.snert.com/Software/mod_throttle/

Then again, its morning, so thinking isnt the greatest  :)

If you used perl or php, then it might be more easier.
Example, when a user clicks on a link to download, have a script 
increment a counter file (you could use a database, but that might be 
too much overhead for something like this), serve the file to the user, 
wait until the file is done downloading, and decrement the counter file 
by one. When someone connects, check the counter file.. if the value is 
3, spit an error out saying try again later.

Also, you could always use FTP..

---
Joe Topjian
email: joe at portsys.net
web: http://zaven.us




More information about the wplug mailing list