limit_rate for POST targets ?

jb justinbeech at
Tue Apr 14 01:02:55 UTC 2015

It is true that the best way to rate limit is the sender. But in the event
where the sender is a myriad different browsers, that isn't an option.
There is no control at the POST level to throttle an upload. There isn't
really any good firewall tool for traffic shaping incoming data per tcp
stream either. You can traffic shape to a port, but not as easily per

For a particular application I'd like to simulate the effect of uploading
at a specific rate. Since I got the desired effect by crudely limiting the
rate at which nginx reads its input socket (with usleep) it seemed possible
that a mirror of the limit_rate code for sending could be applied to
reading as well.

It wouldn't be ideal, but if the server was dedicated to this and not other
things, I'm not sure it would have any disastrous effects?


On Tue, Apr 14, 2015 at 3:03 AM, B.R. <reallfqq-nginx at> wrote:

> I do not get (aha) where you saw limit_rate only applies to the GET
> method...
> But yeah limit_rate applies to resposnes.
> Rate limiting only properly applies to sender, in your case the client,
> which is the sole entity ablte to properly craft its requests to contain a
> specified amount of data/time period.
> ​The only thi​ng you can limit on intermediaries/receiver is
> connections/packets, because it is network-related structures which are
> trivial to handle/buffer.
> Rate-limiting on a transmitting/receiving end requires buffering content
> (not envelope, so that means application logic/DPI), and re-crafting
> forwarded/processed content into suitable network envelopes.
> Way too expensive/dangerous/demanding.
> You can limit incoming transmissions in nginx based on connections
> (limit_conn) or requests (limit_req).
> You can limit incoming transmissions at TCP level in firewalls surch as
> iptables based on connections and/or packets.
> ​My 2 cents,​
> ---
> *B. R.*
> On Sat, Apr 11, 2015 at 2:25 PM, Justin <justinbeech at> wrote:
>> hmm that is rate limiting req/s
>> i am looking for an exact limit_rate equivalent  - which is bytes/second.
>> > On 11 Apr 2015, at 10:13 pm, itpp2012 <nginx-forum at> wrote:
>> >
>> > Lua would be a way to go,
>> > ea.
>> >
>> > Posted at Nginx Forum:
>> >
>> > _______________________________________________
>> > nginx mailing list
>> > nginx at
>> >
>> _______________________________________________
>> nginx mailing list
>> nginx at
> _______________________________________________
> nginx mailing list
> nginx at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list