0

I have a nginx config where I take the cookie to use with this config;

        proxy_set_header Authorization $token;

But if the client put in custom header Authorization this overwrites as I see it the config one. Is it possible to block the client header while using proxy and use my customised header based on variable?

1 Answer 1

1

Yes you can do that. You can use

proxy_hide_header "Authorization";
proxy_set_header Authorization $token;

Or if you want no headers coming from client then you can do below

proxy_pass_request_headers off;
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, I will try this out.
According to the proxy_hide_header documentation, this directive is used to block response headers from being sent back to the client, which is not the case the OP asked about.
@dubek, thanks for pointing that out, seems I mis-judged the usage. And since I never got feedback from OP there was no chance to improve the answer. Did the other approach proxy_pass_request_headers off; work for you?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.