I have a problem with headers not forwarded into my services, I am not sure how support for Ingress was added, however I have the following Ingress service:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-ingress
annotations:
ingress.kubernetes.io/rewrite-target: /
"nginx.org/proxy-pass-headers": "custom_header"
spec:
rules:
- host: myingress.westus.cloudapp.azure.com
http:
paths:
- path: /service1
backend:
serviceName: service1
servicePort: 8080
However, my custom_header will not be forwarded. In nginx I set underscores_in_headers:
underscores_in_headers on;
How can I add this configuration into my ingress nginx service?
Thanks.
I've just changed "true" instead of "on", for nginx ingress controller , and workd for me . As mentioned here : https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-configuration
namespace: ingress-nginx
labels:
app: ingress-nginx
data:
enable-underscores-in-headers: "true"
kubectl apply -f configmap.yml
enter image description here
According to ingress configmap spec you can use this header directly in configspec e.g.:
apiVersion: v1
data:
enable-underscores-in-headers: "on"
kind: ConfigMap
metadata:
name: nginx-configuration
namespace: ingress-nginx
labels:
app: ingress-nginx
kubectl apply -f configmap.yml
Also there is an example of setting custom headers Did you try that?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With