Search code examples
corsistio

Istio ingress - enabling cors


I have a problem with enabling CORS on Istio ingress. As Istio Ingress documentation states, "ingresskubernetes.io" annotations are ignored. Is it possible to enable CORS on Istio ingress?

The ingress in my configuration uses a virtual host and app is exposed on "api.my-domain.com". The web application fails with this error if it tries to request the app : "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin (...) is therefore not allowed access."

Could someone suggest a solution to this issue ?

With the Ngnix ingress controller, I could just use "ingress.kubernetes.io/enable-cors": "true" but now this annotation will not work.


Solution

  • In Istio, you can add a Virtual Service to specify corsPolicy of a destination service. In the case of Istio Ingress, the backend service of the Ingress must be specified as the destination service.