Send original headers to the upstream

Kirill A. Korinsky kirill at korins.ky
Wed Jun 26 09:32:29 UTC 2024


Greetings,

On Wed, 26 Jun 2024 02:42:01 +0100,
Maxim Dounin <mdounin at mdounin.ru> wrote:
> 
> Could you please provide some more details about specific use 
> cases for such a feature?
> 
> As far as I see, using appropriate
> 
>     proxy_set_header X-Original-Foo $http_foo;
> 
> directives should be mostly equivalent, except it won't preserve 
> the headers order and will merge duplicate headers.  But these 
> aren't really guaranteed by HTTP anyway, and merging/reorder can 
> happen on any intermediate hosts.
>

Well, this application needs to preserve HTTP header order and Nginx is used
here as a way to cache some requests.

Nginx runs with a module that parses requests to extract some value that can
be used as cache key, and an application behind Nginx controls when request
can be safely cached via special header in response.

Before Nginx it uses load balancers, but all of them in TCP mode because
headers order is quite important here.

So, provided patch allows to send the headers in the original order.

Thus, it uses one more patch which bring an option to tolerate invalid and
mallformed URI in requests, which I plan to share as the next step.

-- 
wbr, Kirill



More information about the nginx mailing list