disable request buffering in nginx

岁酱吖の 提交于 2019-12-02 21:15:35

According to Gunicorn, they suggest you use nginx to actually buffer clients and prevent slowloris attacks. So this buffering is likely a good thing. However, I do see an option further down on that link I provided where it talks about removing the proxy buffer, it's not clear if this is within nginx or not, but it looks as though it is. Of course this is under the assumption you have Gunicorn running, which you do not. Perhaps it's still useful to you.

EDIT: I did some research and that buffer disable in nginx is for outbound, long-polling data. Nginx states on their wiki site that inbound requests have to be buffered before being sent upstream.

"Note that when using the HTTP Proxy Module (or even when using FastCGI), the entire client request will be buffered in nginx before being passed on to the backend proxied servers. As a result, upload progress meters will not function correctly if they work by measuring the data received by the backend servers."

As soon as this [1] feature is implemented, Nginx is able to act as reverse proxy without buffering for uploads (bug client requests). It should land in 1.7 which is the current mainline.

[1] http://trac.nginx.org/nginx/ticket/251

Update

This feature is available since 1.7.11 via the flag

proxy_request_buffering on | off;

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_request_buffering

Now available in nginx since version nginx-1.7.11.

See documentation http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_request_buffering

To disable buffering the upload specify

proxy_request_buffering off;

I'd look into haproxy to fulfill this need.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!