<p>I want to remove the server name from the error pages returned by the <strong>Kubernetes Nginx ingress controller</strong>. I added the server tokens to be false which takes care of the headers but when I curl or open the ingress in the browser I still get the server name. </p>

<blockquote>
  <p>server-tokens : "False"</p>
</blockquote>

<p><a href="https://i.stack.imgur.com/2o4Gp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2o4Gp.png" alt="enter image description here"></a></p>

<p>I want to get rid of the server name while returning a 404 or any other error for that matter. What is the easiest way to achieve this? I don't have a default backend. Is there any way I can edit the ingress for this backend and add a custom HTML page directly without having to deploy default backends or inject the page using the nginx-configmap?</p>

Anshul Tripathi
<p><code>server-tokens</code> only removes info from the HTTP response header.  You'll need to define custom error pages similar to</p>

<pre><code>server {
  ...

  error_page 500 502 503 504 /custom_50x.html;
}
</code></pre>

<p><a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page" rel="noreferrer">http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page</a></p>
