apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: cors
  namespace: testns
spec:
   hosts:
   - cors.test.istio.io
   ports:
   - number: 80
     name: http
     protocol: HTTP
   resolution: STATIC
   endpoints:
    - address: 127.0.0.2
      ports:
        http: 7072
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: cors
  namespace: testns
spec:
  hosts:
    - cors.test.istio.io
  http:
    - route:
      - destination:
          host: cors.test.istio.io
      corsPolicy:
        allowOrigins:
          - exact: http://foo.example
        allowMethods:
          - POST
          - GET
          - OPTIONS
        allowHeaders:
          - content-type
        exposeHeaders:
          - x-custom-header
        maxAge: 300s
        allowCredentials: true
