Ingress-nginx: hide-headers ConfigMap option cannot set multiple headers

Created on 11 Jan 2019  路  1Comment  路  Source: kubernetes/ingress-nginx

NGINX Ingress controller version: 0.16.2

Kubernetes version (use kubectl version): v1.12.3

Environment:

  • Cloud provider or hardware configuration: Rancher, on-prem (not cloud)
  • OS (e.g. from /etc/os-release): Ubuntu 16.04
  • Kernel (e.g. uname -a): 4.15.0-42-generic
  • Install tools:
  • Others:

What happened: I want to set multiple headers in the hide-headers ConfigMap option as documented at https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#hide-headers. Looking in the nginx template, I see that HideHeaders is expanded using range, which means it's expecting that HideHeaders would be a list (which makes sense). But the ConfigMap only allows a string for the hide-headers option, and emits an error if you try to make it an array: Invalid value: "The edited file failed validation": ValidationError(ConfigMap.data.hide-headers): invalid type for io.k8s.api.core.v1.ConfigMap.data: got "array", expected

What you expected to happen: Array values should be accepted in the ConfigMap, and if that's not possible, then a delimiter should be allowed (e.g. space, comma, semicolon) and the template should split the string into an array when processing.

How to reproduce it (as minimally and precisely as possible):

Edit the ingress ConfigMap, and create a key under data:

data:
  hide-headers:
  - Some-Header
  - Some-Other-Header

Kubernetes will kick this back with an error about Array being an unexpected type. Fine. So what about this:

data:
  hide-headers: "Some-Header Some-Other-Header"

In this case, the template gets expanded incorrectly and nginx kicks back an error:

2019/01/11 17:23:28 [emerg] 11940#11940: invalid number of arguments in "proxy_hide_header" directive in /tmp/nginx-cfg625314691:209
nginx: [emerg] invalid number of arguments in "proxy_hide_header" directive in /tmp/nginx-cfg625314691:209

Most helpful comment

Closing. Configmaps only allow strings. For that reason the correct format is:

data:
  hide-headers: Some-Header,Some-Other-Header

>All comments

Closing. Configmaps only allow strings. For that reason the correct format is:

data:
  hide-headers: Some-Header,Some-Other-Header
Was this page helpful?
0 / 5 - 0 ratings

Related issues

geek876 picture geek876  路  3Comments

oilbeater picture oilbeater  路  3Comments

cabrinoob picture cabrinoob  路  3Comments

kfox1111 picture kfox1111  路  3Comments

c-mccutcheon picture c-mccutcheon  路  3Comments