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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM