Some problems with headers-more-nginx


#1

I have set this directive:

#replaces server information  
more_set_headers 'Server: my-server';

nginx -t is fine but it doesn’t do anything…

i.e.

curl -I www.ict-consult.co.za  
HTTP/1.1 200 OK  
Server: nginx  
Date: Sun, 13 Apr 2014 13:14:20 GMT  
Content-Type: text/html; charset=UTF-8  
Connection: keep-alive  
Vary: Accept-Encoding  
X-Pingback: http://www.ict-consult.co.za/xmlrpc.php  
Link: ; rel=shortlink  
Fastcgi-Cache: MISS  
Strict-Transport-Security: max-age=31536000; includeSubdomains;  
X-Frame-Options: SAMEORIGIN  
X-Content-Type-Options: nosniff  
X-XSS-Protection: 1; mode=block  
X-Page-Speed: 1.7.30.3-3721  
Cache-Control: max-age=0, no-cache

#2

I think you want to change
Server: nginx to Server: my-server

To achieve this you have to recompile nginx
More Info: https://www.digitalocean.com/community/articles/how-to-customize-your-nginx-server-name-after-compiling-from-source-in-centos


#3

I don’t think recompiling is necessary, this is exactly what the HeadersMoreModule does for nginx: http://wiki.nginx.org/HttpHeadersMoreModule

Funnily enough it isn’t working for me…


#4

And now I realized this very weird behavior:

curl -I http://www.ict-consult.co.za/  
HTTP/1.1 200 OK  
Server: nginx  
Content-Type: text/html; charset=UTF-8  
Connection: keep-alive  
Vary: Accept-Encoding  
X-Pingback: http://www.ict-consult.co.za/xmlrpc.php  
Link: ; rel=shortlink  
Fastcgi-Cache: HIT  
Strict-Transport-Security: max-age=31536000; includeSubdomains;  
X-Frame-Options: SAMEORIGIN  
X-Content-Type-Options: nosniff  
X-XSS-Protection: 1; mode=block  
Date: Mon, 12 May 2014 18:50:49 GMT  
X-Page-Speed: Powered By pagespeed  
Cache-Control: max-age=0, no-cache
curl -I http://www.ict-consult.co.za/wp-content/themes/organic_shop/css/admin.css?ver=3.9.1  
HTTP/1.1 200 OK  
Date: Mon, 12 May 2014 18:52:25 GMT  
Content-Type: text/css  
Content-Length: 3404  
Last-Modified: Mon, 17 Dec 2012 21:40:08 GMT  
Connection: keep-alive  
Vary: Accept-Encoding  
ETag: "50cf9138-d4c"  
Server: my-server  
Strict-Transport-Security: max-age=31536000; includeSubdomains;  
X-Frame-Options: SAMEORIGIN  
X-Content-Type-Options: nosniff  
X-XSS-Protection: 1; mode=block  
Accept-Ranges: bytes

Now how come one resource shows a different Server variable from the other one? Any ideas?


#5

@Ovidiu

Its seems like the Server: my-server only works with your custom theme files
Change your theme and cross-check weather that works with default theme?

  
curl -I http://www.ict-consult.co.za/wp-includes/js/jquery/jquery.js\?ver\=1.11.0  
HTTP/1.0 200 OK  
Server: nginx  
Content-Type: application/x-javascript  
Vary: Accept-Encoding  
Content-Length: 96402  
Last-Modified: Tue, 06 May 2014 17:55:13 GMT  
Vary: Accept-Encoding  
ETag: "53692201-17892"  
Strict-Transport-Security: max-age=31536000; includeSubdomains;  
X-Frame-Options: SAMEORIGIN  
X-Content-Type-Options: nosniff  
X-XSS-Protection: 1; mode=block  
Accept-Ranges: bytes  
Cache-Control: max-age=300  
Date: Wed, 11 Jun 2014 09:21:53 GMT  

#6

Thanks but apparently that is a ngx_pagespeed bug.
So what we do know is:
a) PageSpeed runs, Server is left as ‘nginx’
b) PageSpeed doesn’t run, Server is set per the directive.

a) Is indicated by the X-Page-Speed header, b) by the lack thereof.

So, it would appear that if PageSpeed runs it suppresses the more_set_headers directive.

bug => https://github.com/pagespeed/ngx_pagespeed/issues/612


#7