Re: [PATCH] Core: fixed inconsistent state of subrequest's headers_in list

Maxim Dounin mdounin at mdounin.ru
Fri Nov 27 20:39:44 UTC 2020


Hello!

On Fri, Nov 27, 2020 at 07:09:52PM +0100, Jan Prachař wrote:

> On Pá, 2020-11-27 at 20:43 +0300, Maxim Dounin wrote:
> > Hello!
> > 
> > On Thu, Nov 26, 2020 at 09:11:39PM +0100, Jan Prachař wrote:
> > 
> > > # HG changeset patch
> > > # User Jan Prachař  <jan.prachar at gmail.com>
> > > # Date 1606420825 -3600
> > > #      Thu Nov 26 21:00:25 2020 +0100
> > > # Node ID cf3d537ec6706f8713a757df256f2cfccb8f9b01
> > > # Parent  e35b529b03781e64912e0d8a72bd0f957dc08cd2
> > > Core: fixed inconsistent state of subrequest's headers_in list
> > > 
> > > When copying structure ngx_list_t, a reference to the last part need to be
> > > updated, if list contains only one part.
> > > 
> > > This fixes an issue, when adding a header to the subrequest's headers_in list
> > > has no effect.
> > 
> > Thank you for your patch.
> 
> Hello Maxim,
> 
> thank you for your reply.
> 
> > Modules are not expected to modify r->headers_in.  Instead, 
> > consider using appropriate directives to set headers in upstream 
> > requests, notably proxy_set_header.
> 
> Okay, but there are modules that modifies it, notable openresty lua module, because there
> is no other way to modify headers that are sent to upstream on per-request basis.

Certainly there is a way to modify headers that are sent to 
upstream o per-request basis.  As previouly said, proxy_set_header 
is a way to go.  The $proxy_add_x_forwarded_for variable is a good 
example how to do it on a per-request basis.

As for the lua module, I told the very same thing to the author 
more than once.  It's clearly his choice to do things not allowed 
in nginx.

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


More information about the nginx-devel mailing list