lua-resty-upload-rate-limit

限制请求体上传速度

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

resty-upload-rate-limit

此仓库维护了一个最小的 OpenResty 配置和一些 Lua 代码,向您展示如何限制上传速率。

关于这个功能的思路和一些想法

设置

    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

测试

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

主要代码

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

演示

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

作者

luvjoey1996

许可证

3bsd

版本