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