Welcome! Log In Create A New Profile

Advanced

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

Maxim Dounin
March 29, 2018 09:42AM
Hello!

On Wed, Mar 28, 2018 at 04:15:44PM -0400, Ryan Burn wrote:

> > You are not allowed to modify r->headers_in, at any time.
>
> If I want to ensure that certain headers are added if the request is
> proxied upstream, is there any way to do that?

Recommended approach is to export a variable with the appropriate
value, and use

proxy_set_header X-Your-Header $your_variable;

in the configuration.

For example, nginx itself uses this approach with X-Forwarded-For,
see the $proxy_add_x_forwarded_for variable description here:

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#var_proxy_add_x_forwarded_for

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

rnburn 843 March 28, 2018 03:48PM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

Maxim Dounin 511 March 28, 2018 03:58PM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

rnburn 450 March 28, 2018 04:18PM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

Maxim Dounin 452 March 29, 2018 09:42AM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

rnburn 506 March 29, 2018 02:08PM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

Robert Paprocki 448 March 29, 2018 02:36PM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

rnburn 631 March 30, 2018 10:32AM

RE: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

erankor 675 March 31, 2018 10:40AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 136
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready