I am using QS_LocRequestLimitMatch to restrict the number of concurrent connections to 10 for a particular set of URLs being hammered by bots. This works nicely reducing the server load to something manageable.
Now I would like to add some IP block excludes for clients on our local network but cannot get this to work. I have tried using QS_SrvMaxConnExcludeIP which some Google AI search results suggest is indirectly possible. I have also tried marking the IPs as VIPs for use with QS_VipIPHeaderName but without success. The documentation on this topic seems a little hard to digest. Does anyone know of any worked examples which show how to do this?
Thanks
Tom Crane
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the suggestion. That is one of the things I had tried previously but w/o success. It seems that whatever I set for the IP regex it does not apply it. It even ignores,
SetEnvIf Remote_Addr .* QS_VipRequest=yes
I know that it is processing the statement because an illegal regex, e.g. just a * by itself produces an error when starting Apache.
I read that mod_qos advises to use MPM Worker. I am using MPM Event but did try with MPM Worker but it made no difference.
One possible complicating factor is that my webserver is behind a traffic manager/load balancer and I am using mod_remoteip to log the client's IP. That said, I notice that mod_qos correctly logs the client IP and load balancer IPs as shown here (slightly obfuscated for security),
My QS_LocRequestLimitMatch statement (slightly obfuscated for security) used to produce the above log record with the above catch-all QS_VipRequest=yes is,
QS_VipRequest=yes
Disables some restrictions for this request (see privileged Users). Requires the definition of a VIP header using the QS_VipHeaderName directive (this activates VIP verification).
You also need to enable the privileged users using the QS_VipHeaderName parameter, as the variable set by SetEnvIf is ignored otherwise. As a name for the header you can choose something that does not exist.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks very much for that suggestion. The QS_VipHeaderName statement was the part I had been missing and I now have it working nicely.
The documentation could be a little clearer on this. I had also been confused by the mod-qos-vip reference assuming it referred to an existing internal mod_qos component rather than being an arbitrary user choosable label.
Best regards
Tom Crane
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using QS_LocRequestLimitMatch to restrict the number of concurrent connections to 10 for a particular set of URLs being hammered by bots. This works nicely reducing the server load to something manageable.
Now I would like to add some IP block excludes for clients on our local network but cannot get this to work. I have tried using QS_SrvMaxConnExcludeIP which some Google AI search results suggest is indirectly possible. I have also tried marking the IPs as VIPs for use with QS_VipIPHeaderName but without success. The documentation on this topic seems a little hard to digest. Does anyone know of any worked examples which show how to do this?
Thanks
Tom Crane
I suggtest to set the QS_VipRequest variable for the requests which you want to exclude from the QS_LocRequestLimitMatch rules.
example for illustration:
SetEnvIf Remote_Addr 127.0.0.1 QS_VipRequest=yesThanks for the suggestion. That is one of the things I had tried previously but w/o success. It seems that whatever I set for the IP regex it does not apply it. It even ignores,
I know that it is processing the statement because an illegal regex, e.g. just a * by itself produces an error when starting Apache.
I read that mod_qos advises to use MPM Worker. I am using MPM Event but did try with MPM Worker but it made no difference.
One possible complicating factor is that my webserver is behind a traffic manager/load balancer and I am using mod_remoteip to log the client's IP. That said, I notice that mod_qos correctly logs the client IP and load balancer IPs as shown here (slightly obfuscated for security),
My QS_LocRequestLimitMatch statement (slightly obfuscated for security) used to produce the above log record with the above catch-all QS_VipRequest=yes is,
Is there anything I might be missing?
Thanks
Tom Crane
You also need to enable the privileged users using the QS_VipHeaderName parameter, as the variable set by SetEnvIf is ignored otherwise. As a name for the header you can choose something that does not exist.
Thanks very much for that suggestion. The QS_VipHeaderName statement was the part I had been missing and I now have it working nicely.
The documentation could be a little clearer on this. I had also been confused by the mod-qos-vip reference assuming it referred to an existing internal mod_qos component rather than being an arbitrary user choosable label.
Best regards
Tom Crane