Opened 4 years ago
Closed 4 years ago
#1962 closed defect (invalid)
proxy_hide_header don't work, why?
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-module | Version: | 1.14.x |
Keywords: | Cc: | ||
uname -a: | Linux DESKTOP-KJ0R7P8 4.19.84-microsoft-standard #1 SMP Wed Nov 13 11:44:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.14.0 (Ubuntu)
built with OpenSSL 1.1.1 11 Sep 2018 TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-GkiujU/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module |
Description
i want to hide some headers,like Server as below,but find it don't work.
what's wrong with it?
1.edit nginx.conf
server {
....
location = /test {
proxy_hide_header Server;
default_type text/html;
return 200 "hello world";
}
....
}
2.curl 127.0.0.1/test -v
3.find Server header still in response
PS:: although config 'server_tokens off;' may hide the nginx version,but Server header is still left.
Note:
See TracTickets
for help on using tickets.
The
proxy_hide_headers
is to hide headers from the response of a proxied server to a client, and only makes sense withproxy_pass
.As for the
server_tokens
directive behaviour, see ticket #936 for the explanation. In particular, please note the https://en.wikipedia.org/wiki/Security_through_obscurity link.