<p>After deploying Istio 1.1.2 on OpenShift there is an istio-ingressgateway route with its associated service and pod.</p>

<p>I have successfully used that ingress gateway to access an application, configuring a Gateway and a VirtualService using * as hosts.</p>

<p>However I would like to configure a domain, e.g insuranceinc.es, to access the application. According to the documentation I have this Istio config:</p>

<p><strong>Gateway:</strong></p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: insuranceinc-gateway
  namespace: istio-insuranceinc
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "insuranceinc.es"
</code></pre>

<p><strong>VirtualService</strong></p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: insuranceinc
  namespace: istio-insuranceinc
spec:
  hosts:
    - insuranceinc.es
  gateways:
    - insuranceinc-gateway
  http:
    - route:
        - destination:
            host: insuranceinc-web
            port:
              number: 8080
</code></pre>

<p>If I make this curl invocation...</p>

<p><code>curl http://istio-ingressgateway-istio-system.apps.mycluster.com/login</code></p>

<p>... I can see a 404 error in the ingress-gateway pod:</p>

<pre><code>[2019-04-12T15:27:51.765Z] "GET /login HTTP/1.1" 404 NR "-" 0 0 1 - "xxx" "curl/7.54.0" "xxx" "istio-ingressgateway-istio-system.apps.mycluster.com" "-" - - xxx -

</code></pre>

<p>This makes sense since it isn't comming from an insuranceinc.es host. So I change the curl to send a <code>Host: insuranceinc.es</code> header:</p>

<p><code>curl -H "Host: insuranceinc.es"  http://istio-ingressgateway-istio-system.apps.mycluster.com/login</code></p>

<p>Now I am getting a 503 error and there are no logs in the istio-ingressgateway pod.</p>

<blockquote>
  <h1>Application is not available</h1>
  
  <p><p>The application is currently not serving requests at this endpoint. It may not have been started or is still starting.</p></p>
</blockquote>

<p>This means the request hasn't been processed by that istio-ingressgateway route->service->poc. </p>

<p>Since it is an <code>Openshift Route</code> it must be needing a Host header containing the route host <code>istio-ingressgateway-istio-system.apps.mycluster.com</code>. In fact if I send <code>curl -H "Host: istio-ingressgateway-istio-system.apps.mycluster.com"  http://istio-ingressgateway-istio-system.apps.mycluster.com/login</code> it is processed by the istio ingress gateway returning a 404.</p>

<p>So, how can I send my Host insuranceinc.es header and also reach the istio ingress gateway (which is actually an OpenShift route)?</p>

<p>You need to create an openshift route in the istio-system namespace to relate to the hostname you created.  </p>

<p>For example:</p>

<pre><code>oc -n istio-system get routes
NAME              HOST/PORT                                            PATH      SERVICES               PORT      TERMINATION   WILDCARD
gateway1-lvlfn    insuranceinc.es                                                istio-ingressgateway   &lt;all&gt;                   None
</code></pre>
