Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 770 Bytes

README.md

File metadata and controls

29 lines (23 loc) · 770 Bytes

resty-upload-rate-limit

this repo keeps a minimum openresty configuration and some lua code, show you how to limit upload rate.

setup

foo@bar> git clone https://github.com/luvjoey1996/resty-upload-rate-limit.git
foo@bar> cd resty-upload-rate-limit
foo@bar> mkdir logs
foo@bar> openresty -p `pwd` -c nginx.conf

test

foo@bar> curl 127.0.0.1:8888 -T {some file}

main code

-- iter req body, limit upload speed in 200kb/s
for chunk in limit_recv_body(200) do
    ngx.req.append_body(chunk)
end

demo

截图_2020-08-03_23-37-17.png