You could also clear the counter for your known clients by setting the LimitAccessClear variable.
But if you tell modqos to read the IP from a request header (QSClientIpFromHeader) you should ensure to tell modsetenif to do this as well. I assume modremoteip will do the job.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have been trying the exact same thing but its not working for me.
Can you please check?
Here's my config -
# get client IP from HTTP request header instead of client IP
QS_ClientIpFromHeader X-Forwarded-For
#set this counter on every access ( "/" below is the URL )
SetEnvIf Request_URI / RepeatClientRequest
SetEnvIf Remote_Addr 122.160.81.155 !RepeatClientRequest
# no more than 2000 requests for any url in 5 minutes
QS_ClientEventLimitCount 2000 300 RepeatClientRequest
# deny a client IP for 30 minutes if its RepeatedlyAggressive
QS_ClientEventLimitCount 3 1800 RepeatedlyAggressive
QS_SetEnvIf RepeatClientRequest_Counter=1000 RepeatedlyAggressive=1
RemoteAddr is the IP address of the client (peer X-Forwarded-For is a HTTP request header field which contains an IP address (often set by proxy servers).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I want to apply this and have problems to exclude context and ip's :
But only to this context /example and without affect this ip 10.1.0.99
I try this but still affect to all context and ip's:
I have try this to exclude this ip but still not sure if is going to work:
¿can i exclude context and ips with directives QS_ClientEventLimitCount ?
Thanks in advance,
I assume modsetenvif will process the directives in the order they appear in the file. Means unsettling the variable for known clients should work.
You could also clear the counter for your known clients by setting the LimitAccessClear variable.
But if you tell modqos to read the IP from a request header (QSClientIpFromHeader) you should ensure to tell modsetenif to do this as well. I assume modremoteip will do the job.
My bad,
finally this works.
.
.
.
SetEnvIf Request_URI "/example" LimitAccess
SetEnvIfExpr "-R '10.0.0.0/8'" !LimitAccess
QS_ClientEventLimitCount 500 1800 LimitAccess
thanks
I solved it using the X-Forwarded-For instead of Remote_Addr
The problem was that Remote_Addr did not have the client IP so I had to use the X-Forwarded-For -
But I wonder how it worked for you when you are also using the X-Forwarded-For
I have been trying the exact same thing but its not working for me.
Can you please check?
Here's my config -
This is the log -
Am I missing something?
Last edit: Pascal Buchbinder 2024-07-03
RemoteAddr is the IP address of the client (peer
X-Forwarded-For is a HTTP request header field which contains an IP address (often set by proxy servers).
Thanks. I was able to solve it.
@pbuchbinder
Do we need to do this
if we are using X-Forwarded-For?
Last edit: Rahul Sharma 2024-06-28