Ingress-nginx: nginx ingress not respecting http-snippet to remove Server header

Created on 17 Nov 2018  路  3Comments  路  Source: kubernetes/ingress-nginx

NGINX Ingress controller version
0.19.0

Kubernetes version (use kubectl version):
1.9.11

Environment:
Azure AKS

What happened:
Trying to remove the Server header from responses using nginx ingress

What you expected to happen:
Setting this in the values.yaml file should mean the Server: nginx/v.v.v header is removed

controller:
config:
http-snippet: |
more_clear_headers Server;

Re-starting/re-deploying the nginx-ingress-controller pods has no effect, the Server header is still returned

Most helpful comment

I added the following to the config map for the ingress-nginx controller. This worked.

server-tokens: "false"

All 3 comments

@aledbf - I cannot seem to get this to work, are there any examples?

I have added a config map (as below) which matches the namespace and nginx installation name, and added the data block to remove server tokens.

It doesn't seem to have any effect? I am using nginx as a dependency chart within another chart so do not directly edit the charts files.

{ "kind": "ConfigMap", "apiVersion": "v1", "metadata": { "name": "nginx-configuration", "namespace": "web", "selfLink": "/api/v1/namespaces/web/configmaps/nginx-configuration", "uid": "f15f172f-ea49-11e8-9926-a262549d3c9d", "resourceVersion": "1013779", "creationTimestamp": "2018-11-17T09:19:53Z", "labels": { "app": "ingress-nginx" } }, "data": { "server-tokens": "false" } }

Appreciate any pointer

I added the following to the config map for the ingress-nginx controller. This worked.

server-tokens: "false"

Was this page helpful?
0 / 5 - 0 ratings