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设置为自己的前端地址。

posted @ 2021-06-23 11:57  诗码者  阅读(2326)  评论(0编辑  收藏  举报