Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Using a htaccess file or sending special headers from php, is there any way to allow only one http request by ip and url? I mean, an user could make multiple request simultaneously, but not to the same url (file).

The issue comes with the download accelerators. I need to allow multiple dowloads at the same time and also pause and/or resume them (bc of failures in the client's connection, mainly), but disable that annoying function of having multiple partial downloads at the same time because they are making the server crash because of the amount of simultaneously requests.

share|improve this question

migrated from stackoverflow.com Aug 18 '12 at 11:15

This question came from our site for professional and enthusiast programmers.

    
Hi, thank you. I saw that, but the thing is to allow multiple requests from the same ip, but only if the uri are distinct. –  Gabriel Aug 18 '12 at 5:39
3  
ip!=user, one user could have multiple ips and 1 ip could be multiple users. –  Dagon Aug 18 '12 at 5:47
    
This can be accomplished by creating sessions, and/or using a database? Which method would you prefer. The efficient way, would be to utilize a database, that way when a session is destroyed, they still will not be able to access the URL. –  Homework Aug 18 '12 at 6:37
    
Hi. ip!=user, thats true, I should consider it. And yes, I'm doing this programatically if I can't do it as asked, just wanted to know if there were a sipler way first. Thank you two! –  Gabriel Aug 18 '12 at 13:12

1 Answer 1

The server should not crash because of the amount of simultaneous requests. If you are using Apache (as per question tags) try lowering (even dramatically) MaxClients and MinSpareServers or MinSpareThreads. Or also, try out nginx.

share|improve this answer
    
Hi, thank you, it's a shared server, sadly I can't decide that. –  Gabriel Aug 18 '12 at 13:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.