Remove headers from Traefik

Hello,

I have traefik 1.7 installed and I would like to remove and add headers. I am looking for a way for traefik to do it.

I have .net core web application. I can add and remove headers via the .net core app but ideally I want traefik to do the job.

1.7 does not seem to be able to add or remove headers

Hello,

you can remove headers by set customResponseHeaders on the frontend:

labels:
- "traefik.frontend.headers.customResponseHeaders=MyHeader:"

https://docs.traefik.io/v1.7/configuration/backends/docker/#custom-headers

@idez thanks for the feedback

How can i do that with kubernetes ingress using the annotations?

What I am trying to do is to complete remove the Server header. If am not mistaken your approach is to overwrite the header

https://docs.traefik.io/v1.7/configuration/backends/kubernetes/#custom-headers-annotations

when you define an empty value the header is removed.

cool

Thanks you so much. I was about to switch to nginx.

When will a chart for Traefik 2 be out?

I've tried using the annotation on the ingress object to add a 'Access-Control-Allow-Origin:*" header to the responses, but it's not working for me.

annotations:
    kubernetes.io/ingress.class: "traefik"
    ingress.kubernetes.io/custom-response-headers: "Access-Control-Allow-Origin:*"

I checked the logs in the traefik pod and it appears that the configuration was in fact updated, but that header does not appear in the responses yet.

{"level":"debug","msg":"Configuration received from provider kubernetes: {\"backends\": ...
 <removed a bunch of stuff here> ...
"headers\":{\"customResponseHeaders\":{\"Access-Control-Allow-Origin\":\"*\"} ...
}

Any idea what I might be missing? We're using version 1.85.1

Thanks.