kubernetes – X-forwarded-Host Value is getting copied in Host Header while using nginx ingress

I’m hitting on target-app.abc.com and getting the result from source-app.abc.com, so in the request header value for X forwarded Host should be target-app.abc.com and host should be source-app.abc.com but we are getting host as target-app.abc.com

my ingress rule configuration annotations is

  nginx.ingress.kubernetes.io/configuration-snippet: |
       proxy_set_header Host $host;                # Overwrite Host header

if we are using proxy_set_header=Host, then the value of host is getting appended by an additional value of host.

X-forwarded-Host: source-app.abc.com
Host: source-app.abc.com, target-app.abc.com

expected should be :-

X-forwarded-Host: source-app.abc.com
Host: target-app.abc.com

and we have also enabled the use-forwarded-headers: "true" at the global level (in nginx config map)

Read more here: Source link