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

Ryan Burn rnickb731 at gmail.com
Thu Mar 29 18:06:00 UTC 2018


On Thu, Mar 29, 2018 at 9:40 AM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> 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;

This module injects multiple headers and the number, keys, etc aren't
meant to be exposed to the user.

(This module is mean to support tracing and the injected headers btw
correspond to a SpanContext:
http://opentracing.io/documentation/pages/api/cross-process-tracing.html
which varies by the trace used).

Is there way to accomplish this without having the configuration
author do anything?


More information about the nginx-devel mailing list