<div dir="ltr">Yes, apologies for being unclear. Indeed, the upstream proxy is the one generating the duplicate header. My message is primarily concerning the behavior of nginx upon recognizing such a duplicate from the upstream. In order to complete my testing, I wrote an http server as my upstream that purposefully sent duplicate headers. I realize this consider misbehavior of an upstream.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 19, 2023 at 9:06 AM Thomas Ward <<a href="mailto:teward@thomas-ward.net">teward@thomas-ward.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="auto">This sounds like your backend and nginx are both generating the header. NGINX hasn't changed to the point it would create two headers, but if your backend is adding the header as well as nginx then there's your problem.</div>
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
<div id="m_1992154994497908446composer_signature" dir="auto">
<div dir="auto" style="font-size:12px;color:rgb(87,87,87)">Sent from my Galaxy</div>
</div>
<div dir="auto"><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>-------- Original message --------</div>
<div>From: Jesse Stimpson via nginx <<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a>> </div>
<div>Date: 4/19/23 08:57 (GMT-05:00) </div>
<div>To: <a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a> </div>
<div>Cc: Jesse Stimpson <<a href="mailto:jstimpson@relaypro.com" target="_blank">jstimpson@relaypro.com</a>> </div>
<div>Subject: Duplicate Content-Length header with same value, recent change in behavior intentional?
</div>
<div><br>
</div>
<div>
<div dir="ltr">Hello,
<div><br>
</div>
<div>I've noticed a recent change in behavior that occurred between releases 1.22.1 and 1.23.4, and I'm unable to find this particular change documented.</div>
<div><br>
</div>
<div>If an upstream proxy sends a response with duplicate Content-Length headers, both of the same value, nginx 1.22.1 allows the response to be sent to the client, removing the duplicate. However, nginx 1.23.4 (and 1.24.0) responds to the client with a 502.
I did not explicitly test with any other versions.</div>
<div><br>
</div>
<div>I won't try to make any claims on the correctness of either behavior, but it is a change that may affect some workloads.</div>
<div><br>
</div>
<div>Here is an example response that exhibits the change:</div>
<div><br>
</div>
<div>"""</div>
<div>HTTP/1.1 200 OK</div>
<div>Server: http_tcp</div>
<div>Content-Length: 12</div>
<div>Content-Length: 12</div>
<div>Connection: Closed</div>
<div><br>
</div>
<div>Hello World\n<br>
</div>
<div>"""</div>
<div>------</div>
<div><br>
</div>
<div>jstimpson:[~/dev/c/nginx-1.22.1]: curl -i localhost<br>
HTTP/1.1 200 OK<br>
Server: nginx/1.22.1<br>
Date: Wed, 19 Apr 2023 12:17:05 GMT<br>
Content-Length: 12<br>
Connection: keep-alive<br>
<br>
Hello World<br>
</div>
<div><br>
</div>
<div>-----</div>
<div><br>
</div>
<div><br>
</div>
<div>jstimpson:[~/dev/c/nginx-1.23.4]: curl -i localhost<br>
HTTP/1.1 502 Bad Gateway<br>
Server: nginx/1.23.4<br>
Date: Wed, 19 Apr 2023 12:13:09 GMT<br>
Content-Type: text/html<br>
Content-Length: 497<br>
Connection: keep-alive<br>
ETag: "643fd39e-1f1"<br>
</div>
<div><br>
</div>
<div>...<snip>...</div>
<div><br>
</div>
<div><br>
</div>
<div>---------</div>
<div><br>
</div>
<div>These tests were done with this simple config, the rest of the conf is defaults.</div>
<div><br>
</div>
<div> location / {<br>
proxy_pass <a href="http://localhost:4040" target="_blank">http://localhost:4040</a>;<br>
</div>
<div> }</div>
<div><br>
</div>
<div><br>
</div>
<div>Is this change intentional? Did I overlook it in the Changelog?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Jesse</div>
</div>
</div>
</div>
</blockquote></div>