CORS failed due to lots of domain names added in the "cors-allow-origin"
Hi Team,
Our problem:
We have encountered CORS issue because of a huge list of domains set up in 'Access-Control-Allow-Origin.' We are not allowed to use wildcard "*" in domain names due to security restrictions by our clients. There was no issue until we had 3.4k characters length of values in 'cors-allow-origin,' However when we added a few more domains in the list, it became 3.5k characters and started throwing CORS errors in the entire application.
What we need:
We want either the regex support of the subdomains like https://[A-Za-z0-9]+.test.app.com instead https://*.test.app.com, Or please fix the length issue of "cors-allow-origin" annotation. This list might go bigger in future for us.
So please provide us the solutions.
Nginx Ingress Configuration:
nginx_annotations:
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/cors-allow-origin: "https://sub1.test.app.com, https://sub2.test.app.com, https://sub3.test.app.com, https://sub4.test.app.com, https://sub5.test.app.com, https://sub-n.test.app.com"
nginx.ingress.kubernetes.io/cors-allow-headers: "DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type"