ingress-nginx跨域解决

nginx-ingress中解决跨域问题:

在annotations:加入如下配置

 nginx.ingress.kubernetes.io/configuration-snippet: >

      more_set_headers "Access-Control-Allow-Origin: https://www.test.site";

      more_set_headers "Access-Control-Allow-Credentials: true";

      more_set_headers "Access-Control-Allow-Methods: GET, PUT, POST, DELETE,
      PATCH, OPTIONS";

      more_set_headers "Access-Control-Allow-Headers:
      DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization";

  https://www.test.site设置为自己的前端地址。

--------崔帅的拾荒
原文地址:https://www.cnblogs.com/cuishuai/p/14922168.html