How to remove client headers in Nginx before submitting request to upstream server?
The upstream server is wowza which doesn't accept custom headers unless I allow them at the application level.
Nginx is acting as a proxy, from the browser I want to send some custom headers to be received and registered with Nginx Proxy, but these headers must be removed from the request before requesting a redirect to the upstream server.
This way, the upstream server will never know what is where the custom headers are.
I've tried proxy_hide_header
as well proxy_set_header "<header>" ""
, but it looks like they apply to response headers, not request headers.
And even if I agree to include headers on wowza, then again I cannot find a way to enable server-level headers for all applications. Currenlty I need to add headers for every newly created application that I do not find possible.
Any help would be appreciated.
source to share
proxy_set_header HEADER ""
does exactly what you expect. See https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header .
If the value of the header field is empty string, this field will not be passed to the proxy server:
proxy_set_header Accept-Encoding "";
I just confirmed that this works as documented, I was using Nginx v1.12.
source to share