> Why do you want to do this?
In a cluster of many nginx servers we had one faulty node that was delivering only errors. In that special case a default vhost replied an "domain not configured" error, because the underlying configuration was inaccessible. The health check was not firing, because such errors are normal (bad bots try to access removed domains or simply make up host headers).
A client that was round-robin balanced to that faulty nginx instance was delivered the error page, but the connection was still active. Every subsequent request to our domain had hit the same bad instance. The google bot uses each connection for 100 requests. They all ran into the error. Same for browsers: When you hit reload, you will run into the same problem until the connection times out.
If the connection was closed immediately there would be a good chance to be load-balanced to another instance.
In http/1 "Connection: close" does the job. but most of our traffic is h2.