<p>I'm trying to set up a proxy service in the Kubernetes cluster using istio. I have created two different domains. If the domain is foo.com it should be redirected to an external URL else it should be routed to an app server. I have configured this using virtual service and service entry. But when I hit foo.com it is skipping the Authorization header. I need an Authorization header to process the request. Is there any way to fix this issue? Thanks in advance.</p>
<p>VirtualService.yaml</p>
<pre><code>apiVersion: networking.istio.io/v1beta1
kind: ServiceEntry
metadata:
  name: external-svc-https
spec:
  hosts:
  - foo.com
  location: MESH_EXTERNAL
  ports:
  - number: 443
    name: https
    protocol: TLS
  resolution: DNS
---
kind: VirtualService
apiVersion: networking.istio.io/v1alpha3
metadata:
  name: redirect
  namespace: default
  labels:
    app: foo
    env: staging
spec:
  hosts:
    - foo.com
  gateways:
    - istio-system/gateway
  http:
    - match:
        - uri:
            prefix: /
      redirect:
        authority: bar.com
</code></pre>

<p>if to redirect when <code>foo.com</code> domain get hit</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: github
spec:
  hosts:
  - &quot;raw.githubusercontent.com&quot;
  location: MESH_EXTERNAL
  ports:
  - number: 443
    name: https
    protocol: TLS
  resolution: DNS
</code></pre>
<p>and</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: webserver
spec:
  hosts:
  - foo.com
  http:
  - match:
    - uri:
        regex: &quot;.*&quot;
    rewrite:
      uri: &quot;/mcasperson/NodejsProxy/master/externalservice1.txt&quot;
      authority: raw.githubusercontent.com
    route:
    - destination:
        host: raw.githubusercontent.com
        port:
          number: 443
</code></pre>
<p>rule</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: github
spec:
  host: &quot;raw.githubusercontent.com&quot;
  trafficPolicy:
    tls:
      mode: SIMPLE
</code></pre>
<p>read more at : <a href="https://octopus.com/blog/istio/istio-serviceentry" rel="noreferrer">https://octopus.com/blog/istio/istio-serviceentry</a></p>
