lua-resty-upload-rate-limit

limit request body upload speed

$ opm get luvjoey1996/lua-resty-upload-rate-limit

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

Authors

luvjoey1996

License

3bsd

Versions