Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NGINX Ingress Controller hide Nginx version

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?

server_tokens off

Thanks SR

like image 279
sfgroups Avatar asked Nov 29 '18 00:11

sfgroups


1 Answers

If you look at the configs you'll see that server_tokens can be either in the http, server, location contexts in your nginx.conf. So, on the nginx ingress controller to it really depends on where you want to add that setting (and how):

  • 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 http snippet option.

  • server context can be done either through the server-snippet ConfigMap option or the server-snippet annotation on a per Ingress basis.

  • location context can be done either through the location snippet ConfigMap option or the configuration snippet on a per Ingress basis.

like image 156
Rico Avatar answered Oct 21 '22 14:10

Rico