<p>I using NGINX Ingress Controller in Kubernetes cluster, need to hide the Nginx version information for the client request. since Nginx configuration file generated dynamically. What is the best way to include below line in nginx.conf file?</p>

<pre><code>server_tokens off
</code></pre>

<p>Thanks
SR</p>

sfgroups
<p>If you look at the <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens" rel="noreferrer">configs</a> you'll see that <code>server_tokens</code> can be either in the <code>http, server, location</code> contexts in your <code>nginx.conf</code>. So, on the nginx ingress controller to it really depends on where you want to add that setting (and how):</p>

<ul>
<li><p>http context means for all configs in the ingress controller so you'd have to change in the nginx ingress controller config map using the <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/configmap.md#http-snippet" rel="noreferrer">http snippet</a> option.</p></li>
<li><p>server context can be done either through the <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/configmap.md#server-snippet" rel="noreferrer">server-snippet</a> ConfigMap option or the <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md#server-snippet" rel="noreferrer">server-snippet annotation</a> on a per Ingress basis.</p></li>
<li><p>location context can be done either through the <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/configmap.md#location-snippet" rel="noreferrer">location snippet</a> ConfigMap option or the <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md#configuration-snippet" rel="noreferrer">configuration snippet</a> on a per Ingress basis.</p></li>
</ul>
