Conditionally removing a proxy header

eckern nginx-forum at forum.nginx.org
Tue May 12 19:01:05 UTC 2020


I'm trying to conditionally remove a proxy header but this doesn't appear to
be allowed using an "if". Ideally it would look something like this where
$external_traffic is either 0 or 1:

if ($external_traffic) {
	...
	proxy_hide_header WWW-Authenticate; # Remove negotiate header
	...
}

My workaround is to set up another site with proxy_hide_header set and do a
redirect to it inside the if instead but that seems messy.

if ($external_traffic) {
	...
	rewrite ^ https://external.testdomain.com$request_uri break;
	...
}

Is there a better way to do this?

Thanks,
Neil

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,288015,288015#msg-288015



More information about the nginx mailing list