nginx seems to be replacing the Connection: close
header that upstream is sending, and replacing it with a Connection: keep-alive
header. Is there any way I can override it?
http {
upstream main {
server 127.0.0.1:8000;
}
server {
listen 443;
ssl on;
ssl_certificate server.crt;
ssl_certificate_key server.key;
location / {
proxy_pass http://main;
}
location /find {
proxy_pass http://main;
proxy_buffering off;
}
}
}
Setting keepalive_requests 0;
convinced nginx to send Connection: close
.
The Connection header is specific to a connection.
From the HTTP/1.1 spec,
The Connection general-header field allows the sender to specify options that are desired for that particular connection and MUST NOT be communicated by proxies over further connections.
So what nginx sends is independent of what's being sent from upstream and must be. Here are some options:
keepalive_requests 0 works if you never want connections reused.
keepalive_disable ua works for a particular user agent.
And this answer works an ip.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With