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

Is it possible to limit each IP requesting a page from my Apache server to, say, 1 request per second?

share|improve this question
    
What do you want to happen if someone tries to request two pages per second? Do you want to send them an error page? –  DerfK Jan 30 '11 at 16:09
    
Preferably, their second request would wait forma second. –  igul222 Jan 30 '11 at 16:16
    
Make sure you're using keep-alive for this to be feasible. Browsers usually request 3-4 files until all is fetched and without keep-alive a new connection is made for each file. –  Mark Mar 7 '11 at 12:26
add comment

2 Answers

What you really want is a program called tc which pairs up with iptables to limit traffic.

There's another recent post asking about bandwidth limiting. The answer is the same for both of you.
controlling the bandwidth using tc

share|improve this answer
add comment

In Apache this is not done. bw_mod limit bandwidth. tc limit bandwidth. iptables connlimit limit connection. You may use iptables string and recent modules, but it is not a pretty solution.

share|improve this answer
add comment

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.