Bart Pelle
Bart Pelle

Reputation: 747

Nginx limit_rate not applied to proxy_pass

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.

Upvotes: 3

Views: 2415

Answers (1)

VBart
VBart

Reputation: 15110

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

Upvotes: 4

Related Questions