Welcome! Log In Create A New Profile

Advanced

Re: Conditionally removing a proxy header

Francis Daly
May 14, 2020 06:10PM
Hi there,

I'm not certain why you want to do the specific example that you want
to do; but if I were doing the general "conditionally remove header"
thing, I would probably use "map" to set a new variable "$my_value"
based on your variable "$external_traffic".

If $external_traffic is 1, set $my_value to blank.

Otherwise, set $my_value to $upstream_http_www_authenticate.

And then always "proxy_hide_header WWW-Authenticate;" and
"add_header WWW-Authenticate $my_value always;"

If the value is blank, add_header does not write the header. And "always"
is because you probably only get the WWW-Authenticate on a 401 response.

http://nginx.org/r/map
http://nginx.org/r/$upstream_http_
http://nginx.org/r/add_header

(Note the standard caveats about directive inheritance, particularly
regarding add_header, if that applies in your config.)

Hope this helps!

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Conditionally removing a proxy header

eckern May 12, 2020 03:01PM

Re: Conditionally removing a proxy header

Francis Daly May 14, 2020 06:10PM

Re: Conditionally removing a proxy header

eckern May 21, 2020 04:38PM

Re: Conditionally removing a proxy header

Francis Daly May 26, 2020 12:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 270
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