How do you change the server header returned by nginx?

daniels picture daniels · Oct 29, 2008 · Viewed 168.4k times · Source

There's an option to hide the version so it will display only nginx, but is there a way to hide that too so it will not show anything or change the header?

Answer

Brandon Rhodes picture Brandon Rhodes · Feb 12, 2012

If you are using nginx to proxy a back-end application and want the back-end to advertise its own Server: header without nginx overwriting it, then you can go inside of your server {…} stanza and set:

proxy_pass_header Server;

That will convince nginx to leave that header alone and not rewrite the value set by the back-end.