nginx limit_rate if in location - strange behaviour - possible bug ?

Bozhidara Marinchovska quintessence at bulinfo.net
Wed Oct 9 14:41:30 UTC 2013


I'm sorry, misread documentation.

Placed set $limit_rate 0 in my case1 instead limit_rate 0 and now works 
as expected.


On 09.10.2013 17:21 ч., Bozhidara Marinchovska wrote:
> Hi,
>
> nginx -V
> nginx version: nginx/1.4.2
> configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I 
> /usr/local/include' --with-ld-opt='-L /usr/local/lib' 
> --conf-path=/usr/local/etc/nginx/nginx.conf 
> --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid 
> --error-log-path=/var/log/nginx-error.log --user=www --group=www 
> --http-client-body-temp-path=/var/tmp/nginx/client_body_temp 
> --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp 
> --http-proxy-temp-path=/var/tmp/nginx/proxy_temp 
> --http-scgi-temp-path=/var/tmp/nginx/scgi_temp 
> --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp 
> --http-log-path=/var/log/nginx-access.log 
> --with-http_image_filter_module --with-http_stub_status_module 
> --add-module=/usr/ports/www/nginx/work/naxsi-core-0.50/naxsi_src 
> --with-pcre
>
> FreeBSD 9.1-STABLE #0: Sat May 18 00:32:18 EEST 2013 amd64
>
> I'm using limit_rate case if in location. Regarding documentation "if 
> in location" context is avaiable.
>
> My configuration is as follows:
>
> location some_extension {
>
> # case 1
> if match_something {
> root ...
> break;
> }
>
> # case 2
> if match_another {
> root ...
> break;
> }
>
> # else (case3)
> root ...
> something other ...
> here it is placed also limit_rate / limit_after directives
> }
>
> There is a root inside location with a (strong) reason :) (nginx 
> pitfails case "root inside location block - BAD").
>
> When I open in my browser http://my.website.com/myfile.ext it matches 
> case 3 from the cofiguration. Limit_rate/limit_after works correct as 
> expected.
> I want case1 not to have limit_rate / limit_after.
>
> Test one:
> In case1 I place limit_rate 0, case3 is the same limit_rate_after XXm; 
> limit_rate some_rate. When I open in my browser URL matching case1 - 
> limit_rate 0 is ignored. After hitting XXm from the file I get 
> limit_rate from case 3.
>
> Test 2:
> In case 1 I place limit_rate_after 0; limit_rate 0, case3 is the same 
> limit_rate_after XXm; limit_rate some rate. When I open in my browser 
> URL matching case 1 - limit_rate_after 0 and limit_rate 0 are ignored. 
> Worst is that when I try to download the file, I even didn't match 
> case3 - my download starts from the first MB with limit_rate bandwidth 
> from case3.
>
> Both tests are made in interval from 20 minutes, 1 connection from my 
> IP, etc.
>
> I don't post my whole configuration, because may be it is unnessesary. 
> If cases are with http_referer.
>
> Case 1 - if I see referer some_referer, I do something. (here I don't 
> want to place any limits)
> Case 2 - If I see another referer , I do something else.
> Case 3 - Else ... something other (here I have some limits)
>
> I'm sure I match case1 when I test (nginx-error.log with debug say 
> it), I mean my configuration with cases is working as expected, the 
> new thing is limit_rate and limit_rate_after which is not working as 
> expected.
>
> Any thoughts ? Meanwhile I will test on another version.
>
> Thanks
>
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list