'Access-Control-Allow-Origin to allow Multiple Origin Domains/ Subdomain using Traefik

Is there a way to allow multiple cross-domains using the Access-Control-Allow-Origin header using Traefik?

I'm aware of the *, but it is wildcard. I really want to allow just a couple domains.

As an example, something like this:

traefik.http.middlewares.pa.headers.customresponseheaders.Access-Control-Allow-Origin: 'http://domain1.example, http://domain2.example'

Is it possible to specify multiple domains/subdomains or am I stuck with just one?

The purpose of using this is for cookie based operations, where ui is hosted in abc.example.com, where credentials are set to include. In traefix the settings are with below configurations, hosted at xyz.example.com

  traefik.http.middlewares.pa.headers.customresponseheaders.Access-Control-Allow-Headers: 'content-type,realm'
  traefik.http.middlewares.pa.headers.customresponseheaders.Access-Control-Allow-Methods: 'GET,POST,PUT,PATCH,DELETE,OPTIONS'
  traefik.http.middlewares.pa.headers.customresponseheaders.Access-Control-Allow-Credentials: 'true'
  traefik.http.middlewares.pa.headers.customresponseheaders.Access-Control-Allow-Origin: 'http://abc.example.com'

But i have many UIs like efg.example.com and pqr.example.com.

Any help is much appreciated.



Solution 1:[1]

No currently I suppose.

Issue reported

Corresponding PR

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1