zoukankan      html  css  js  c++  java
  • k8s-ingress增加跨域问题

    第一种:

    kubectl get ingresses.   -n rrzhibo-admin   test-rrzb-apiadmin-gateway-http-ingress    -o yaml
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      annotations:
        kubectl.kubernetes.io/last-applied-configuration: |
          if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Max-Age' 1728008;
            add_header 'Access-Control-Allow-Origin' '*' always;
            add_header 'Access-Control-Allow-Headers' '*';
            add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,DELETE,PATCH,OPTIONS';
            return 200;
           }
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
        nginx.ingress.kubernetes.io/cors-allow-headers: DNT,web-token,app-token,Authorization,Accept,Origin,Keep-Alive,User-Agent,X-Mx-ReqToken,X-Data-Type,X-Auth-Token,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,token,Cookie
        nginx.ingress.kubernetes.io/cors-allow-methods: PUT, GET, POST, OPTIONS
        nginx.ingress.kubernetes.io/cors-allow-origin: '*'
        nginx.ingress.kubernetes.io/enable-cors: "true"
        nginx.ingress.kubernetes.io/proxy-body-size: 300m
      name: test-rrzb-apiadmin-gateway-http-ingress
      namespace: rrzhibo-admin
    spec:
      rules:
      - host: 域名
        http:
          paths:
          - backend:
              serviceName: rrzb-admin-gateway-http-svc
              servicePort: 8089
            path: /
    status:
      loadBalancer: {}
    

    第二种:

        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
        nginx.ingress.kubernetes.io/cors-allow-headers: '*'
        nginx.ingress.kubernetes.io/cors-allow-methods: PUT, GET, POST, OPTIONS, DELETE
        nginx.ingress.kubernetes.io/cors-allow-origin: http://test-admin.d.rrinner.cn   ( 指定域名)
        nginx.ingress.kubernetes.io/enable-cors: "true"
    

    阿里云增加跨域
    找到路由——>变更——>注解

    本文来自博客园,作者:武兴旺,转载请注明原文链接:https://www.cnblogs.com/wuxingwang/p/14519246.html

  • 相关阅读:
    Perl Resources
    使用Perl管理Oracle数据库
    Tomcat 发布部署jsp网站—-使用自己的ip访问jsp网站
    Lode's Computer Graphics Tutorial Image Filtering
    Java Image Filters
    ZPhotoEngine超级算法库
    ps亮度对比度算法
    滤镜艺术---新海诚(你的名字)滤镜特效的实现解密
    Cocoa-GL-Tutorial
    Learning Cocoa with Objective-C
  • 原文地址:https://www.cnblogs.com/wuxingwang/p/14519246.html
Copyright © 2011-2022 走看看