Kubernetes Inress-nginx CORS:如何允许多个来源?

um6iljoc  于 2022-10-06  发布在  Kubernetes
关注(0)|答案(0)|浏览(121)

目前有可能允许一个域或子域,但我想允许多个来源。我尝试了很多方法,比如用片段添加标题,但没有成功。

这是我当前的入口配置:

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'

我还想将CORS-Allow-Origin扩展为:

nginx.ingress.kubernetes.io/cors-allow-origin: 'https://example.com, https://otherexample.com'

是否有可能以其他方式允许多个域?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题