It's currently possible to allow a single domain or subdomain but I would like to allow multiple origins. I have tried many things like adding headers with snipets but had no success.
This is my current ingress configuration:
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: nginx-ingress
namespace: default
selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/nginx-ingress
uid: adcd75ab-b44b-420c-874e-abcfd1059592
resourceVersion: '259992616'
generation: 7
creationTimestamp: '2020-06-10T12:15:18Z'
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
ingress.kubernetes.io/enable-cors: 'true'
ingress.kubernetes.io/force-ssl-redirect: 'true'
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: 'true'
nginx.ingress.kubernetes.io/cors-allow-credentials: 'true'
nginx.ingress.kubernetes.io/cors-allow-headers: 'Authorization, X-Requested-With, Content-Type'
nginx.ingress.kubernetes.io/cors-allow-methods: 'GET, PUT, POST, DELETE, HEAD, OPTIONS'
nginx.ingress.kubernetes.io/cors-allow-origin: 'https://example.com'
nginx.ingress.kubernetes.io/enable-cors: 'true'
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/secure-backends: 'true'
I also would like to extend the cors-allow-origin like:
nginx.ingress.kubernetes.io/cors-allow-origin: 'https://example.com, https://otherexample.com'
Is it possible to allow multiple domains in other ways?
A some time ago, ingress-nginx allows multiple origins. See issue https://github.com/kubernetes/ingress-nginx/issues/5496
Example of usage:
nginx.ingress.kubernetes.io/cors-allow-origin: "https://example.com, https://another.com, http://localhost:8000"