<p>I having an issue trying to get Istio working on my cluster. My infrastructure looks like this:</p>

<p>I have a Magento Store with a varnish as front cache. It was working before istio installation. I have already enabled envoy injection. Varnish is deployed in a pod and has its own service redirects uncached to magento service.</p>

<p>The problem comes when I try to curl from varnish to magento.</p>

<p>If I curl magento service from varnish I get a redirect to magento URL (which is the expected behavior)</p>

<pre><code>root@varnish-6468d5958d-dvxhx:/# curl -v store-es    
* Rebuilt URL to: store-es/
*   Trying 10.32.97.229...
* TCP_NODELAY set
* Connected to store-es (10.32.97.229) port 80 (#0)
&gt; GET / HTTP/1.1
&gt; Host: store-es
&gt; User-Agent: curl/7.52.1
&gt; Accept: */*
&gt; 
&lt; HTTP/1.1 301 Moved Permanently
&lt; server: envoy
&lt; date: Wed, 07 Nov 2018 11:08:47 GMT
&lt; content-type: text/html
&lt; content-length: 185
&lt; location: https://store-sta.xxxxx.yyy/
&lt; myheader: store-es-6484d46d66-952xj
&lt; x-envoy-upstream-service-time: 4
&lt; 
&lt;html&gt;
&lt;head&gt;&lt;title&gt;301 Moved Permanently&lt;/title&gt;&lt;/head&gt;
&lt;body bgcolor="white"&gt;
&lt;center&gt;&lt;h1&gt;301 Moved Permanently&lt;/h1&gt;&lt;/center&gt;
&lt;hr&gt;&lt;center&gt;nginx/1.13.8&lt;/center&gt;
&lt;/body&gt;
&lt;/html&gt;
* Curl_http_done: called premature == 0
* Connection #0 to host store-es left intact
</code></pre>

<p>But when I try the same but using a Host header to skip magento redirection I got a 404:</p>

<pre><code>root@varnish-6468d5958d-dvxhx:/# curl -v -H "Host: store-sta.xxxxx.yyy" store-es    
* Rebuilt URL to: store-es/
*   Trying 10.32.97.229...
* TCP_NODELAY set
* Connected to store-es (10.32.97.229) port 80 (#0)
&gt; GET / HTTP/1.1
&gt; Host: store-sta.xxxxx.yyy
&gt; User-Agent: curl/7.52.1
&gt; Accept: */*
&gt; 
&lt; HTTP/1.1 404 Not Found
&lt; date: Wed, 07 Nov 2018 11:11:59 GMT
&lt; server: envoy
&lt; content-length: 0
&lt; 
* Curl_http_done: called premature == 0
* Connection #0 to host store-es left intact
</code></pre>

<p>I have checked logs and requests whit Host header are never arriving to magento service (store-es in my example). And when I check varnish envoy's log is the one which is returning a 404:</p>

<pre><code>[2018-11-07T11:11:50.548Z] "GET /HTTP/1.1" 404 NR 0 0 0 - "-" "curl/7.52.1" "e754b17f-ae2e-4734-beb4-f7a2d6e412da" "store-sta.xxxxx.yyy" "-" - - 10.32.97.229:80 10.32.67.5:45540
</code></pre>

<p>Do you know why is this happening? Why host header is returning a 404 without requesting magento service?</p>

<p>I also want to mention that magento is working without varnish and it's able to connect to redis (in the same cluster) and mysql (outside cluster) so I have discarded a magento's trouble.</p>

<p>I have a similar issue where the Host header hitting envoy is an external domain which does not match the internal service entry name (it never would). As it does not match it gets a 404, I think there must be a way to configure this with VirtualService but not sure how yet.</p>
