<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi there<div><br class="webkit-block-placeholder"></div><div>We're running a site for a large company using 0.5.35.&nbsp;Their IT security team insists that the "Server: nginx" HTTP header must be removed. I've set "server_tokens off" in both http and server sections, and the version number is no longer shown, but I still get "Server: nginx".</div><div><br class="webkit-block-placeholder"></div><div>I need to remove this completely, as they may actually insist we change server software if this is not done.</div><div><br class="webkit-block-placeholder"></div><div>Is there a way to do this through config?</div><div><br class="webkit-block-placeholder"></div><div>In the meantime, as I don't have time to learn the ngx code well enough to add a config directive of my own, I've *removed* the following lines in&nbsp;src/http/ngx_http_header_filter_module.c, rebuilt, and the header is, obviously, no longer sent.</div><div><br class="webkit-block-placeholder"></div><div>But will this cause other problems?</div><div><br class="webkit-block-placeholder"></div><div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="">&nbsp;48</span><span style="color: #aa0d91">:&nbsp;static</span> <span style="color: #aa0d91">char</span> ngx_http_server_string[] = <span style="color: #c41a16">"Server: nginx"</span> CRLF;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="">&nbsp;49</span><span style="color: #aa0d91">:&nbsp;static</span> <span style="color: #aa0d91">char</span> ngx_http_server_full_string[] = <span style="color: #c41a16">"Server: "</span> NGINX_VER CRLF;</div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div>
</div></div><div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">127: &nbsp; &nbsp;{ ngx_string(<span style="color: #c41a16">"Server"</span>), offsetof(ngx_http_headers_out_t, server) },</div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div>
</div></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">243: &nbsp; &nbsp;<span style="color: #aa0d91">if</span> (r-&gt;headers_out.server == <span style="color: #aa0d91">NULL</span>) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">244: &nbsp; &nbsp; &nbsp; &nbsp;len += clcf-&gt;server_tokens ? <span style="color: #aa0d91">sizeof</span>(ngx_http_server_full_string) - <span style="color: #1c00cf">1</span>:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">245: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: #aa0d91">sizeof</span>(ngx_http_server_string) - <span style="color: #1c00cf">1</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">246: &nbsp; &nbsp;}</div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div>
</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">284: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;+ r-&gt;server_name.len</div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div>
</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">295: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;+ r-&gt;server_name.len</div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div>
</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">369: &nbsp; &nbsp;<span style="color: #aa0d91">if</span> (r-&gt;headers_out.server == <span style="color: #aa0d91">NULL</span>) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">370: &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #aa0d91">if</span> (clcf-&gt;server_tokens) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">371: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;p = (u_char *) ngx_http_server_full_string;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">372: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;len = <span style="color: #aa0d91">sizeof</span>(ngx_http_server_full_string) - <span style="color: #1c00cf">1</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; ">373:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">374:&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; } <span style="color: #aa0d91">else</span> {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">375:&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p = (u_char *) ngx_http_server_string;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">376:&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; len = <span style="color: #aa0d91">sizeof</span>(ngx_http_server_string) - <span style="color: #1c00cf">1</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">377:&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; ">378:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">379:&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; b-&gt;last = ngx_cpymem(b-&gt;last, p, len);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">380:&nbsp;&nbsp;&nbsp; }</div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div>
</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">447: &nbsp; &nbsp; &nbsp; &nbsp;b-&gt;last = ngx_copy(b-&gt;last, r-&gt;server_name.data, r-&gt;server_name.len);</div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">I hope this doesn't go against the whole nginx philosophy - I'm normally quite proud about nginx server tokens!</span></span></font></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">But if it's either "do this or use Apache", then I'd rather do this ...</span></span></font></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div>
</div><div>Many thanks,</div><div>Igor</div><div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Igor Clark // POKE // 10 Redchurch Street // E2 7DD // +44 (0)20 7749 5355 // <a href="http://www.pokelondon.com">www.pokelondon.com</a></div><div><br></div></div></div></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br></div></body></html>