Re:Common Nginx misconfigurations that leave your web server...
by HajiraSifre on Thursday February 25, 2021 @05:19AM
(#26261510)
You just have to use ngx_headers_more instead of the built-in headers module.
That add_header would get fixed (as a sibling comment states it should) is unlikely as it is intended to work that way:
> There could be several add_header directives. These directives are inherited from the previous configuration level if and only if there are no add_header directives defined on the current level.
It really is too bad that the functionality provided by ngx_headers_more isn't available out of the box, since it makes it a pain to use nginx on distributions that don't package it.
Re:Common Nginx misconfigurations that leave your web server...
by weinzierl on Thursday February 25, 2021 @05:35AM
(#26261599)
In addition to that, the ngx_headers_more module also solves the second issue I mentioned. It can be used to remove the Server header completely.
Re:Common Nginx misconfigurations that leave your web server...
by 2ion on Thursday February 25, 2021 @09:03AM
(#26262793)
It should also be noted that setting the server token as part of nginx core is part of their commercial offering [1].
[1] http://nginx.org/en/docs/http/ngx_http_core_module.html#serv...
Re:Common Nginx misconfigurations that leave your web server...
by secondcoming on Thursday February 25, 2021 @09:11AM
(#26262874)
I think Apache forces some sort of Server header too.
Re:Common Nginx misconfigurations that leave your web server...
by Symbiote on Thursday February 25, 2021 @11:35AM
(#26264672)
The minimum is
Server: Apache
with the ServerSignature and ServerTokens configuration parameters.
As some headers have security implications this is an easy way to shoot yourself in the foot.
Another security related point is the suppression of the server version. While nginx can omit the version number out-of-the-box, you unfortunately need an extension to remove the header completely.