[PATCH 10 of 14] Proxy: always emit "Host" header first
piotrsikora at google.com
Wed Jul 5 10:29:15 UTC 2017
> As already outlined in the review here:
> the approach taken looks very fragile. There should be a better
> way to do this.
I disagree. The change is minimal (which is something that you seem to
always prefer) and works perfectly fine.
Yes, it's based on the assumption that "Host" header is the first of
default headers, but I don't think that's bad and I can't imagine the
order magically changing by itself... Also, the check if the first key
is "Host" could be probably removed.
As for your suggested alternatives:
Emitting default headers first, would - just like you mentioned - lose
the benefit of order defined by "proxy_set_header" directives, and as
such would change the order on the wire, so I'd rather avoid this
Emitting "Host" header separately, via different means, would require
more drastic code changes, for little to no benefit.
Anyway, you're more than welcome to provide alternative patch, but I
don't see anything wrong with the current approach, so I'm unlikely to
rewrite it myself.
More information about the nginx-devel