limit_req is not working in virutal location?

pva nginx-forum at forum.nginx.org
Thu Jan 11 08:32:07 UTC 2018


Hi. Could you, please, explain why limit_req in @limitspeed location is not
working in case of redirect to @allowed virtual location and works in case I
copy @allowed virtual location contents inside @limitspeed? 

================= This configuration is not limiting speed at all
========================
    location @allowed {
        root /store/;
        try_files /live$uri @localdvr;
    }

    location @limitspeed {
        limit_req zone=limit_req_rate;
        limit_rate 2500000;
        error_page 420 = @allowed;
        return 420;
    }

    location ~ ^/limit_speed_for_ts/.*\.ts {
        proxy_intercept_errors on;
        recursive_error_pages on;
        error_page 418 = @limitspeed;
        error_page 419 = @allowed;
        # we allow all requests with if there is token argument without
limiting speed
        if ($arg_token = "") {
            return 418;
        }
        return 419;
    }
============================================

But if I change @limitspeed it will work:

    location @limitspeed {
        limit_req zone=limit_req_rate;
        limit_rate 2500000;
        root /store/;
        try_files /live$uri @localdvr;
    }


Why?

Thanks in advance for any hints.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,278101,278101#msg-278101



More information about the nginx mailing list