Menu

QS_LocRequestLimitDefault not applying limits when using mod_rewrite

2025-02-27
2025-03-03
  • Jurgen Goelen

    Jurgen Goelen - 2025-02-27

    Hello *,

    I've been struggling with an issue where QS_LocRequestLimitDefault isn't working when combined with mod_rewrite. Here's my configuration:

    <virtualhost *:80="">
     ServerName slow.local
     Header setIfEmpty Strict-Transport-Security "max-age=31536000; includeSubDomains"</virtualhost>

    ProxyPreserveHost On
     RewriteEngine On
     RequestHeader unset Origin

    QS_LocRequestLimitDefault 50

    RewriteRule ^/(.*)$ http://slow_backend:8000/$1 [L,P]

    ProxyPassReverse / http://slow_backend:8000/

    The interesting part is that when I replace the RewriteRule with a standard ProxyPass directive, the request limiting works as expected. However, I need to use mod_rewrite for most of our configurations due to complex URL manipulation requirements.
    Has anyone else encountered this issue? Is there a known interaction between mod_qos and mod_rewrite that prevents QS_LocRequestLimitDefault from applying properly when using the [P] flag?
    Any suggestions for getting request limiting to work while still using RewriteRule would be greatly appreciated!

    Thanks in advance!

    Jurgen Goelen

     
    • Pascal Buchbinder

      QS_LocRequestLimitDefault 50 is basically QS_LocRequestLimit / 50 which does not match your proxy request (which starts with a "h") anymore.

      I assume that QS_LocRequestLimitMatch ^http 50 will do the trick.

       
  • Jurgen Goelen

    Jurgen Goelen - 2025-03-03

    The regular expression QS_LocRequestLimitMatch ^http 50 didn't work, but modifying it to QS_LocRequestLimitMatch ^.*$ 50 solved the problem.

    Thanks!

     

Log in to post a comment.