0

I am looking to configure header based routing using virtual service and destination rule. Below is the config.

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: direct-cnn-through-egress-gateway
  namespace: test
spec:
  exportTo:
    - "."
    - "istio-system"
  hosts:
  - domain1.com
  http:
  - match:
    - headers:
        x-b3-custom-header:
          exact: "true" # Match requests with the x-route-header header
    rewrite:
      uri: "/some/ab/sdf/1/Event"
      authority: domain2.com
    route:
    - destination:
        host: domain2.com
        port:
          number: 443
  - route:
    - destination:
        host: domain1.com
        port:
          number: 9334
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: originate-tls-for-domain1
  namespace: test
spec:
  host: domain1.com
  exportTo:
    - "."
    - "istio-system"
  trafficPolicy:
    portLevelSettings:
    - port:
        number: 9334
      tls:
        mode: SIMPLE # initiates HTTPS for connections to edition.cnn.com
        sni: domain1.com
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: originate-tls-for-domain2
  namespace: test
spec:
  exportTo:
    - "."
    - "istio-system"
  host: domain2.com
  trafficPolicy:
    portLevelSettings:
    - port:
        number: 443
      tls:
        mode: SIMPLE
        sni: domain2.com

When I do " curl -v -X POST 'http://domain1.com:9334/some/ss/2' --header 'x-b3-custom-header: true' --header 'Content-Type: application/json' ". I am getting 200 response code but I am not getting any response body from this post request. Without header I am able to get proper response body. If I hit the curl directly to domain2.com I am getting the proper response body. Not exactly sure what is causing this issue. Am I missing something in the configuration?

0 Answers0