浏览 3.3k
在一个项目中,我使用Nginx做7层的反向代理。根据需求,我需要对某个接口做下载限流操作,配置文件如下:
http {
...
}
server {
...
location /download {
proxy_set_header Connection "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Accel-Mapping /home/nginx/path/=/example/;
limit_rate 100k;
proxy_redirect off;
proxy_max_temp_file_size 0;
proxy_pass http://127.0.0.1:3345;
}
}
配置完重启Nginx后,发现速未生效,将location中的limit_rate和X-Accel-Mapping的顺序调整后,限速是正常的,是什么原因。
nginx version:openresty/1.21.4.1
built with gcc 4.8.5 20150623(Redhat 4.8.5-44) (GCC)

按点赞数排序
按时间排序
微信公众号
加入微信群