NGINX Pass-through server header

How do I get NGINX to pass through the 'server' header of upstream servers?

Like, if NGINX is proxying to an Apache server with the Server header 'Apache2.2 (CentOS)', it strips it out and replaces it with 'NGINX/1.0.1'. We have our machine ID's in our Server: headers so we need to get NGINX to stop over-writing them.


Nginx does not have a way to turn off the server header, the closest option is the server token directive but this only turns off the version number.

I have never actually tried this, but the proxy_pass_header directive might allow you to specify the Server header as something that should be passed on to the client.

I'd personally recommend sending the machine ID in a custom header designed for it (X-WHATEVER) as using a RFC defined header for behaviour other than what it's designed for is bound to bite you eventually.

If proxy_pass_header doesn't work then I'm pretty sure the only alternative is that you patch the Nginx source to not overwrite it.


The directive proxy_pass_header does exactly what you want:

proxy_pass_header Server;