Traefik customResponseHeaders not working

4/22/2020

I would like to add 'Access-Control-Allow-Origin: *' to the response headers from responses served by our traefik load balancer in kubernetes. We're using traefik-1.85.1

I've added these annotations to the ingress object:

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

And looking at the logs from the traefik pod, it seems that the configuration is loaded, but the header is not showing up in the responses.

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

Am I going about this the correct way? It seems to me like this should work. I must be misunderstanding something.

Thanks in advance for responding.

-- ear
kubernetes
traefik-ingress

0 Answers