I need to hide some headers for a specific path. I have the following nginx config:
server { listen 80; location / { set $x_hide_header "X-Foo-Bar"; if ($uri ~ "some-path$") { set $x_hide_header "Header-I-Need-To-Hide"; } proxy_hide_header $x_hide_header; proxy_pass } } But the header still exists. If I add proxy_hide_header "Header-I-Need-To-Hide" it disappears, but I need to hide it only for a specific path, as was said above. Looks like nginx interprets the variable in proxy_hide_header as string literal. Is there any workaround?
I can do this by defining another location and copying all from the current one + proxy_hide_header, but I won't do this. Maybe there is another solution?
Related questions 1138 Node.js + Nginx - What now? 644 Nginx -- static file serving confusion with root & alias 0 Is it real to stop( exit from location ) execute location with good return code in nginx? Related questions 1138 Node.js + Nginx - What now? 644 Nginx -- static file serving confusion with root & alias 0 Is it real to stop( exit from location ) execute location with good return code in nginx? 3 Nginx setting expires header with proxy 579 Nginx no-www to www and www to no-www 0 setting nginx proxy_pass on ubuntu server 14 Edit a header value in nginx 0 Is it possible to specify an uri in Nginx proxy_pass? 396 NGinx Default public www location? Load 6 more related questions Show fewer related questions
Reset to default