How do I let nginx close the tcp connection instantly after the request is fulfilled?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I just found the solution:
location /ip/ {
keepalive_timeout 0;
}
回答2:
The connection is maintained between the server and the browser thanks to the Keep Alive requests exchanged between them.
You can disable the Keep Alive behavior for a particular user agent: see the nginx manual
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.