# Can't setting CORS Traefik V2

**URL:** <https://community.traefik.io/t/cant-setting-cors-traefik-v2/10386>\
**Category:** Traefik v2\
**Tags:** kubernetes-ingress\
**Created:** [April 19, 2021, 1:46am UTC](https://community.traefik.io/t/cant-setting-cors-traefik-v2/10386 "2021-04-19T01:46:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuzujoe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/yuzujoe/32/2899_2.png) [@yuzujoe](https://community.traefik.io/u/yuzujoe)\
**Post date:** [April 19, 2021, 1:46am UTC](https://community.traefik.io/t/cant-setting-cors-traefik-v2/10386/1 "2021-04-19T01:46:14Z")

</div>

I'm trying to raise the version of Traefik I'm building on Kubernetes from v1 to v2.

I was able to update itself, but when I try to use the application after updating the Traefik version to v2, I get a CORS error.

I checked the documentation and found that CORS can be configured in the middleware configuration, so I configured it as follows.

trying to access `https://backend.example.com` from `https://front.example.com`

```auto
[http.middlewares]
  [http.middlewares.testHeader.headers]
    accessControlAllowMethods= ["GET", "OPTIONS", "PUT", "POST", "DELETE"]
    accessControlAllowOriginList = ["https://*.example.com"]
    accessControlMaxAge = 100
    addVaryHeader = true

```

- ingress setting

```auto
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: example-app
  labels:
    app.kubernetes.io/name: example-app
  annotations:
    ingress.kubernetes.io/whitelist-x-forwarded-for: "true"
    ingress.kubernetes.io/protocol: https
    traefik.ingress.kubernetes.io/router.tls: "true"
    kubernetes.io/ingress.class: traefik
spec:
  rules:
    - host: backend.example.com
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              serviceName: example-app
              servicePort: 443

```

but this problem not sloved.

When I checked the error, I found that the preflight had failed.

```shell
has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

```

I would like to know if there is any part of the problem and if there are any other settings that need to be made.

Thank you.

---

<div class="post-metadata">

**Author:** ![yuzujoe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/yuzujoe/32/2899_2.png) [@yuzujoe](https://community.traefik.io/u/yuzujoe)\
**Post date:** [April 20, 2021, 2:03am UTC](https://community.traefik.io/t/cant-setting-cors-traefik-v2/10386/2 "2021-04-20T02:03:02Z")

</div>

Loading the configured middleware solves the preflight problem, but the CORS problem is still there.

---

<div class="post-metadata">

**Author:** ![tommoulard](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/tommoulard/32/2997_2.png) [@tommoulard](https://community.traefik.io/u/tommoulard)\
**Post date:** [April 20, 2021, 7:06am UTC](https://community.traefik.io/t/cant-setting-cors-traefik-v2/10386/3 "2021-04-20T07:06:01Z")

</div>

Hi there @yuzujoe, I think the plugin [traefik-plugin-cors](https://github.com/pxxonline/traefik-plugin-cors) might be able to help you 🙂  
See the [pilot's plugin page](https://pilot.traefik.io/plugins/605afbdfa5f67ab9a1b0e53c/traefik-cors-plugin).
