Force nginx to close connection instantly Force nginx to close connection instantly nginx nginx

Force nginx to close connection instantly


I just found the solution:

location /ip/ {    keepalive_timeout 0;}


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.