Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx limit_rate not applied to proxy_pass

Tags:

nginx

debian

Is there any specific reason why limit_rate does not apply to proxy_pass? Having the following configuration block in nginx, I can still download the proxied file at ~4MB/s:

location ~ ^/proxy? {
    resolver 8.8.8.8;
    set $limit_rate  50k;
    limit_rate       50k;
    proxy_limit_rate 50k;
    proxy_buffering off;
    proxy_buffer_size 15m;
    proxy_pass_request_body off;
    proxy_read_timeout 20s;
    proxy_pass  $arg_fwd;
}

System is Debian 8 with Nginx 1.10.1. No extra modules are installed aside from the default packaged ones in apt.

like image 305
Bart Pelle Avatar asked Oct 20 '25 14:10

Bart Pelle


1 Answers

proxy_buffering off; and rate limiting are mutually exclusive. You should enable buffering to use the limit rate feature.

like image 127
VBart Avatar answered Oct 22 '25 05:10

VBart