Custom header replacement by Traefik

I’m wondering if someone could clarify this part of the documentation for me:

https://docs.traefik.io/basics/#custom-headers

If the custom header name is the same as one header name of the 
request or response, it will be replaced.

The way I read it is that if I try to set a custom response header in Traefik and the header already exists in the response coming back from the backend, the backend response header will prevail.

I have traefik running in Service Fabric and have a Label for adding "Cache-Control" custom header to responses. However, this replaces the header coming back from the backend app, as well.

Hello @Amir,

No, The custom headers module will Overwrite headers.

If your backend sets X-Foo, and you have X-Foo set as a custom response header, then the custom header you configured will overwrite the one from the backend.

Ok. Thanks.

Then I think the language in the documentation isn't quite clear.

1 Like