javascript 强制nginx立即关闭连接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17010346/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Force nginx to close connection instantly
提问by fnkr
How do I let nginx close the tcp connection instantly after the request is fulfilled?
如何在请求完成后让 nginx 立即关闭 tcp 连接?
回答by fnkr
I just found the solution:
我刚刚找到了解决方案:
location /ip/ {
keepalive_timeout 0;
}
回答by e2-e4
The connection is maintained between the server and the browser thanks to the Keep Alive requests exchanged between them.
由于服务器和浏览器之间交换了 Keep Alive 请求,因此在服务器和浏览器之间保持连接。
You can disable the Keep Alive behavior for a particular user agent: see the nginxmanual
您可以为特定用户代理禁用保持活动的行为:看到了nginx的手册
keepalive_disable ua
You can probably trick your browser to have a given user agent, having the keep alive cut only for your particular needs.
您可能会欺骗您的浏览器使用给定的用户代理,仅针对您的特定需求进行保持活动。