headers-more-nginx-module
headers-more-nginx-module copied to clipboard
Headers not clearing
I'm not sure what is going on here since I had it working before, but headers aren't clearing properly:
more_clear_headers "Server:*";
more_clear_headers "X-Page-Speed:*";
more_clear_headers "X-Powered-By:*";
more_clear_headers "X-CF-Powered-By:*";
Is what I tried, but the the headers are still appearing. I tried restart nginx multiple times with different configurations:
more_clear_headers "Server: ";
more_clear_headers "X-Page-Speed: ";
more_clear_headers "X-Powered-By: ";
more_clear_headers "X-CF-Powered-By: ";
and more_clear_headers "Server:"; more_clear_headers "X-Page-Speed:"; more_clear_headers "X-Powered-By:"; more_clear_headers "X-CF-Powered-By:";
Here is Nginx -V: nginx version: nginx/1.6.0 built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --add-module=/tmp/nginx-1.6.0/debian/modules/ngx_pagespeed --add-module=/tmp/nginx-1.6.0/debian/modules/headers-more-nginx-module --with-http_spdy_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --with-ipv6
I'm using Ubuntu 12.04 with Nginx 1.6.0. Thanks!
@DrDinosaur I've run ngx_headers_more's test suite with nginx 1.6.0 and all tests are passing.
Will you try ngx_headers_more without ngx_pagespeed (and other 3rd-party modules)? It is known that ngx_pagespeed can introduce problems here.
@DrDinosaur BTW, the recommended syntax for the more_clear_headers
directive is like this:
more_clear_headers Server X-Page-Speed X-Powered-By X-CF-Powered-By;
Consult the documentation for more details:
https://github.com/openresty/headers-more-nginx-module#more_clear_headers
It appears that turning on ngx_pagespeed directly attributes to the server header being shown. Without it, the header does not show. With it turned on, the header does show.
@DrDinosaur Then I think you should report the issue to ngx_pagespeed's maintainer instead.
I think https://github.com/pagespeed/ngx_pagespeed/pull/645 will fix this.
same occured to me, not able to clear the header information . nginx/1.18.0 and Phusion Passenger(R) 6.0.10
would you please give up a minimal example that can reproduce this problem?
We also recently found that more_clear_headers
suddenly stopped working in our SlickStack project, I never realized the syntax we were using was incorrect... this is how we had it for years:
more_clear_headers "Pragma";
more_clear_headers "Expires";
more_clear_headers "Cache-Control";
After changing as suggested, it now works again:
more_clear_headers "Pragma Expires Cache-Control";
Ref: https://github.com/littlebizzy/slickstack/blob/master/modules/nginx/nginx-conf.txt
Nothing like an 8-year old GitHub Issue to save the day, thanks! ;)
My findings are the same as @jessuppi's, except that the recommended syntax also fails to work. The date
header seems irremovable (even though we never used to need to remove it because it wasn't exposed by default before.)