Force nginx to close connection instantly

2019-04-22 08:16发布

How do I let nginx close the tcp connection instantly after the request is fulfilled?

2条回答
趁早两清
2楼-- · 2019-04-22 08:26

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.

查看更多
男人必须洒脱
3楼-- · 2019-04-22 08:48

I just found the solution:

location /ip/ {
    keepalive_timeout 0;
}
查看更多
登录 后发表回答