I am planning to limit user bandwidth. I came across post_action
directive in core module and thinking if I can get response size served by nginx
and send it to code using post_action
.
Any ideas how can I do that?
nginx
sets its $body_bytes_sent
variable to the size of the HTTP response.
$bytes_sent
too which includes headers. See this answer: serverfault.com/a/346857/44112
Jul 6, 2016 at 5:17
There's a built-in solution to limit user bandwith in the HttpCoreModule
of nginx
. Let's say for example that you want to limit bandwith to 20kB/s:
set $limit_rate 20k;