1

I am configuring a reverse proxy in nginx using proxy_pass. I am then using proxy_set_header to override certain request headers and proxy_hide_header to remove certain response headers.

This effectively creates a blacklist of headers that I do not want to pass through my proxy.

Ideally, though, I would want to define a whitelist of headers that are allowed to pass through. For example, I might want to hide all headers except Content-Type and Content-Length (and a few others, probably).

Is there any mechanism in nginx to implement this sort of header whitelist while proxying? I can't seem to find this in this nginx documentation or through Google searches.

Thanks!

1

There is openresty/headers-more-nginx-module on github. Seems to fit your needs quite well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.