limit_rate_after support variables

Miroslav Novy miranovy at gmail.com
Thu Aug 30 07:01:05 UTC 2018


Hi,
 we are interested :)

I tried your patch with actual sources, the solution is very similar to my,
you just use the functions. It is better.

I tried it with this configuration:

...
 location / {
    root /var/www/default/;
            index  index.html index.htm;

    set $my_limit_rate 2k;
    set $my_limit_rate_after 2m;

    limit_rate $my_limit_rate;
    limit_rate_after $my_limit_rate_after;

    access_by_lua_block {
ngx.var.my_limit_rate = '4k'
ngx.var.my_limit_rate_after = '10m'
    }
        }
 ...

Settings of limit_rate_after works good :) But settings of limit_rate
throws warning and value is always set to zero. The problem is that they
try to retrieve the value of the variable before it is set by the set
command.

2018/08/28 10:36:22 [warn] 8180#0: *1 using uninitialized "my_limit_rate"
variable, client: 10.255.255.10, server: localhost, request: "GET
/iloveyou_words.mp4 HTTP/1.1", host: "mira-nginx.dev.srw.cz"
2018/08/28 10:36:22 [debug] 8180#0: *1 http script var: ""
2018/08/28 10:36:22 [debug] 8180#0: *1 http cl:-1 max:1048576
2018/08/28 10:36:22 [debug] 8180#0: *1 rewrite phase: 2
2018/08/28 10:36:22 [debug] 8180#0: *1 http script value: "2k"
2018/08/28 10:36:22 [debug] 8180#0: *1 http script set $my_limit_rate

Can you help me with this?

Thanks
Míra Nový
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20180830/d7d16501/attachment.html>


More information about the nginx-devel mailing list