CorsPolicy not working

Unable to get the corsPolicy to work.
below is my configs
am i doing something wrong ?

Istio Version:“1.1.7”

 curl 35.xx.xx.xx.nip.io/hello -v                                                                                        
*   Trying 35.xx.xx.xx...
* TCP_NODELAY set
* Connected to 35.xx.xx.xx.nip.io (35.xx.xx.xx) port 80 (#0)
> GET /hello HTTP/1.1
> Host: 35.xx.xx.xx.nip.io
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< content-type: text/html; charset=utf-8
< content-length: 59
< date: Thu, 13 Jun 2019 07:16:47 GMT
< server: istio-envoy
< 
Hello version: v2, instance: helloworld-v2-6489d9fb5-qcm5j
* Connection #0 to host 35.xx.xx.xx.nip.io left intact

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  generation: 1
  name: helloworld-gateway
  namespace: temp
  resourceVersion: "48893351"
spec:
  selector:
    istio: ingressgateway
  servers:
  - hosts:
    - 35.xx.xx.xx.nip.io
    port:
      name: http-helloworld
      number: 80
      protocol: HTTP
  - hosts:
    - 35.xx.xx.xx.nip.io
    port:
      name: https-helloworld
      number: 443
      protocol: HTTPS
    tls:
      credentialName: httpbin-credential2
      mode: MUTUAL

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  generation: 1
  name: helloworld
  namespace: temp
spec:
  gateways:
  - helloworld-gateway
  hosts:
  - 35.xx.xx.xx.nip.io
  http:
  - corsPolicy:
      allowCredentials: true
      allowHeaders:
      - authorization
      - content-type
      - accept
      - origin
      - user-agent
      allowMethods:
      - POST
      allowOrigin:
      - foo.example
      exposeHeaders:
      - x-custom-header
      maxAge: 300s
    match:
    - uri:
        exact: /hello
    removeResponseHeaders:
    - server
    - x-envoy-upstream-service-time

output from istioctl

{
        "name": "http.80",
        "virtualHosts": [
            {
                "name": "35.xx.xx.xx.nip.io:80",
                "domains": [
                    "35.xx.xx.xx.nip.io",
                    "35.xx.xx.xx.nip.io:80"
                ],
                "routes": [
                    {
                        "match": {
                            "path": "/hello"
                        },
                        "route": {
                            "cluster": "outbound|5000||helloworld.temp.svc.cluster.local",
                            "timeout": "0s",
                            "retryPolicy": {
                                "retryOn": "connect-failure,refused-stream,unavailable,cancelled,resource-exhausted,retriable-status-codes",
                                "numRetries": 2,
                                "retryHostPredicate": [
                                    {
                                        "name": "envoy.retry_host_predicates.previous_hosts"
                                    }
                                ],
                                "hostSelectionRetryMaxAttempts": "3",
                                "retriableStatusCodes": [
                                    503
                                ]
                            },
                            "cors": {
                                "allowOrigin": [
                                    "foo.example"
                                ],
                                "allowMethods": "POST",
                                "allowHeaders": "authorization,content-type,accept,origin,user-agent",
                                "exposeHeaders": "x-custom-header",
                                "maxAge": "300",
                                "allowCredentials": true,
                                "filterEnabled": {
                                    "defaultValue": {
                                        "numerator": 100
                                    }
                                }
                            },
                            "maxGrpcTimeout": "0s"
                        },
                        "metadata": {
                            "filterMetadata": {
                                "istio": {
                                    "config": "/apis/networking/v1alpha3/namespaces/temp/virtual-service/helloworld"
                                }
                            }
                        },
                        "decorator": {
                            "operation": "helloworld.temp.svc.cluster.local:5000/hello"
                        },
                        "perFilterConfig": {
                            "mixer": {
                                "forward_attributes": {
                                    "attributes": {
                                        "destination.service.host": {
                                            "string_value": "helloworld.temp.svc.cluster.local"
                                        },
                                        "destination.service.name": {
                                            "string_value": "helloworld"
                                        },
                                        "destination.service.namespace": {
                                            "string_value": "temp"
                                        },
                                        "destination.service.uid": {
                                            "string_value": "istio://temp/services/helloworld"
                                        }
                                    }
                                },
                                "mixer_attributes": {
                                    "attributes": {
                                        "destination.service.host": {
                                            "string_value": "helloworld.temp.svc.cluster.local"
                                        },
                                        "destination.service.name": {
                                            "string_value": "helloworld"
                                        },
                                        "destination.service.namespace": {
                                            "string_value": "temp"
                                        },
                                        "destination.service.uid": {
                                            "string_value": "istio://temp/services/helloworld"
                                        }
                                    }
                                }
                            }
                        },
                        "responseHeadersToRemove": [
                            "server",
                            "x-envoy-upstream-service-time"
                        ]
                    }
                ]
            }
        ],
        "validateClusters": false
    },

I have tried to redo everything again with httpbin

this is the service

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: httpbin
spec:
  hosts:
  - abcd.127.0.0.1.nip.io
  gateways:
  - httpbin-gateway
  http:
  - match:
    - uri:
        prefix: "/feedup"
    rewrite:
      uri: "/"
    route:
    - destination:
        host: httpbin
        port:
          number: 8000
      corsPolicy:
        allowOrigin:
        - example.com
        allowMethods:
        - POST
        - GET
        allowCredentials: false
        allowHeaders:
        - X-Foo-Bar
        maxAge: "24h"

this is the route config generated by istio

 {
        "name": "http.80",
        "virtualHosts": [
            {
                "name": "abcd.127.0.0.1.nip.io:80",
                "domains": [
                    "abcd.127.0.0.1.nip.io",
                    "abcd.127.0.0.1.nip.io:80"
                ],
                "routes": [
                    {
                        "match": {
                            "prefix": "/feedup"
                        },
                        "route": {
                            "cluster": "outbound|8000||httpbin.default.svc.cluster.local",
                            "prefixRewrite": "/",
                            "hostRewrite": "",
                            "timeout": "0s",
                            "retryPolicy": {
                                "retryOn": "connect-failure,refused-stream,unavailable,cancelled,resource-exhausted,retriable-status-codes",
                                "numRetries": 2,
                                "retryHostPredicate": [
                                    {
                                        "name": "envoy.retry_host_predicates.previous_hosts"
                                    }
                                ],
                                "hostSelectionRetryMaxAttempts": "3",
                                "retriableStatusCodes": [
                                    503
                                ]
                            },
                            "cors": {
                                "allowOrigin": [
                                    "example.com"
                                ],
                                "allowMethods": "POST,GET",
                                "allowHeaders": "X-Foo-Bar",
                                "maxAge": "86400",
                                "allowCredentials": false,
                                "filterEnabled": {
                                    "defaultValue": {
                                        "numerator": 100
                                    }
                                }
                            },
                            "maxGrpcTimeout": "0s"
                        },
                        "metadata": {
                            "filterMetadata": {
                                "istio": {
                                    "config": "/apis/networking/v1alpha3/namespaces/default/virtual-service/httpbin"
                                }
                            }
                        },
                        "decorator": {
                            "operation": "httpbin.default.svc.cluster.local:8000/feedup*"
                        },                        "perFilterConfig": {
                            "mixer": {
                                "forward_attributes": {
                                    "attributes": {
                                        "destination.service.host": {
                                            "string_value": "httpbin.default.svc.cluster.local"
                                        },
                                        "destination.service.name": {
                                            "string_value": "httpbin"
                                        },
                                        "destination.service.namespace": {
                                            "string_value": "default"
                                        },
                                        "destination.service.uid": {
                                            "string_value": "istio://default/services/httpbin"
                                        }
                                    }
                                },
                                "mixer_attributes": {
                                    "attributes": {
                                        "destination.service.host": {
                                            "string_value": "httpbin.default.svc.cluster.local"
                                        },
                                        "destination.service.name": {
                                            "string_value": "httpbin"
                                        },
                                        "destination.service.namespace": {
                                            "string_value": "default"
                                        },
                                        "destination.service.uid": {
                                            "string_value": "istio://default/services/httpbin"
                                        }
                                    }
                                }
                            }
                        }
                    }
                ]
            }
        ],
        "validateClusters": false
    }

but still does not see to work :frowning: