Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#807 closed defect (wontfix)

ngx_http_rewrite_module duplicate Server header

Reported by: baranyaib90@… Owned by:
Priority: minor Milestone: 1.9.6
Component: nginx-module Version: 1.9.x
Keywords: rewrite server header duplicate Cc: gcc, version, 4.8.2, (Ubuntu, 4.8.2-19ubuntu1)
uname -a: Linux vm 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: ./auto/configure --with-ipv6 --prefix=. --sbin-path=nginx --conf-path=nginx.conf --error-log-path=logs/error.log --pid-path=nginx.pid --with-pcre

Description

Config snippet:
server
{

listen 192.168.0.2:80;
add_header Server "MyServer";
return 200 $server_addr;

}

Result:

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 08 Oct 2015 14:04:41 GMT
Content-Type: text/plain
Content-Length: 11
Connection: keep-alive
Server: MyServer

192.168.0.2

Change History (3)

comment:1 by Commenter123@…, 9 years ago

You can't overwrite nginx 'Server' header without editing source.
See: http://stackoverflow.com/questions/246227/how-do-you-change-the-server-header-returned-by-nginx

However I still think this is a bug, but they won't change it.

comment:2 by Maxim Dounin, 9 years ago

Resolution: wontfix
Status: newclosed

The add_header directive can be used to add headers, but it doesn't allow to overwrite existing/standard headers, including the Server header (the only exceptions are Last-Modified and ETag).

To control what nginx returns in the Server header there is the server_tokens directive. If it's not enough for you - well, we're sorry, but that's not something we like and not something we are going to allow. The link above suggests a bunch of workarounds you can use if you don't care about nginx, nginx developers, and our feelings.

comment:3 by baranyaib90@…, 9 years ago

Hi!
Thank you all, for the response.
I do care about nginx, nginx developers, and their feelings :)
I wanted to use this little trick for debug purpose. (Than I found this minor bug.)
I promise, next time I will not report anything...
Have a nice day.

Note: See TracTickets for help on using tickets.