Send original headers to the upstream

Maxim Dounin mdounin at mdounin.ru
Thu Jun 27 19:18:10 UTC 2024


Hello!

On Wed, Jun 26, 2024 at 10:32:29AM +0100, Kirill A. Korinsky wrote:

> 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.

Well, this looks like highly specialized use case focusing on 
non-guaranteed HTTP properties.

While it might be nice to support this use case as well, it seems 
to be at most optional.  And I can't say I like the proposed 
solution.

-- 
Maxim Dounin
http://mdounin.ru/



More information about the nginx mailing list