Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
I didn't write the software (Personally I think it's a stupid idea but anyway. I'll have a play around with the proxy_pass_header and if all else fails start messing around in the source code =) – Smudge Jun 12 '11 at 10:06

Any headers from the original response might be preserved using the $upstream_http_* variables, for your case:

add_header Server $upstream_http_server;

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.