无法在Insio中获得corsPolicy

时间:2019-06-13 10:25:46

标签: cors istio

我正在尝试让iosio 1.1.7上的CorsPolicy起作用,但是istio忽略了与corspolicy相关的任何内容,RemoveResponseHeaders起作用。 但是只有access-control-allow-origin和access-control-allow-credentials没有显示。

它在Docker for Desktop上全新安装。 (我确定一切都会重置),使用默认安装配置文件。


➜  istio-1.1.7 curl abcd.127.0.0.1.nip.io/anything -I
HTTP/1.1 200 OK
server: istio-envoy
date: Thu, 13 Jun 2019 10:08:10 GMT
content-type: application/json
content-length: 977
access-control-allow-origin: *
access-control-allow-credentials: true

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: httpbin-gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - abcd.127.0.0.1.nip.io
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: httpbin
  labels:
    app: httpbin
spec:
  hosts:
  - abcd.127.0.0.1.nip.io
  gateways:
  - httpbin-gateway
  http:
  - match:
    route:
    - destination:
        host: httpbin
        port:
          number: 8000
    corsPolicy:
      allowOrigin:
      - 'abcd.com'
      allowCredentials: false
      allowMethods: 
      - POST
      allowHeaders:
      - X-Foo-Bar
      maxAge: "24h"
    removeResponseHeaders:
    - x-envoy-upstream-service-time


---
apiVersion: v1
kind: Service
metadata:
  name: httpbin
  labels:
    app: httpbin
spec:
  ports:
  - name: http
    port: 8000
    targetPort: 80
  selector:
    app: httpbin
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: httpbin
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: httpbin
        version: v1
    spec:
      containers:
      - image: docker.io/kennethreitz/httpbin
        imagePullPolicy: IfNotPresent
        name: httpbin
        ports:
        - containerPort: 80

0 个答案:

没有答案