<p>I'm running a react container in <code>Kubernetes</code> env (AKS) with an <a href="https://istio.io/latest/docs/tasks/traffic-management/ingress/ingress-control/" rel="nofollow noreferrer">istio gateway</a></p>
<p>In local env, everything works well using <code>docker build &amp;&amp; docker run</code></p>
<p>In Kubernetes, for each npm package, the response I'm getting is <code>status code: 200, response content-type: text/html</code>, and the response content is of <code>index.html</code> which is why I'm assuming package was not found?</p>
<ul>
<li>When checking docker dist content, I can assert that the package is there (for example <code>/dist/npm.babel.4fca54....chunk.js</code> is present</li>
<li>docker image is built using a base context: <code>docker build -t imagename --build-arg PUBLIC_URL=/base-app .</code></li>
<li>index.html is valid and contains valid script declarations. for example <code>&lt;script type=&quot;text/javascript&quot; src=&quot;/base-app/npm.babel.743f....chunk.js&quot;&gt;&lt;/script&gt;</code></li>
</ul>
<p><strong>Istio Gateway</strong></p>
<pre class="lang-yaml prettyprint-override"><code>spec:
  selector:
  istio: ingressgateway
  servers:
    - hosts:
      - dev.myDomain.com
      port:
        name: https
        number: 443
        protocol: HTTPS
      tls:
        credentialName: someCreds
        mode: SIMPLE
</code></pre>
<p><strong>Istio VS</strong></p>
<pre class="lang-yaml prettyprint-override"><code>   - match:
    - uri:
        prefix: /base-app
     route:
      - destination:
          host: svc-app
          port:
            number: 8000
</code></pre>
<p><strong>Example for a Request + headers</strong></p>
<pre><code>Request URL: https://dev.myDomain.com/base-app/npm.babel.4fca5....chunk.js
Request Method: GET
Status Code: 200 
Remote Address: xxx.xxx.xxx:443
Referrer Policy: no-referrer-when-downgrade
</code></pre>
<p><strong>Response Headers</strong></p>
<pre><code>accept-ranges: bytes
content-length: 11920 ---&gt; length of index.html
content-type: text/html --&gt; bad needs to be text/javascript
date: Tue, 11 Aug 2020 21:30:07 GMT
etag: &quot;5f32aff9-2e90&quot;
last-modified: Tue, 11 Aug 2020 14:49:29 GMT
server: istio-envoy
status: 200
x-envoy-upstream-service-time: 4
</code></pre>

royB
<p>By default Istio will proxy from <code>https://dev.myDomain.com/base-app/npm.babel.4fca5....chunk.js</code> to <code>http://pod_ip:8000/base-app/npm.babel.4fca5....chunk.js</code>, and, as far as I can tell, your image serves files directly from <code>/dist</code>, so Istio should actually proxy to <code>http://pod_ip:8000/npm.babel.4fca5....chunk.js</code>; note the missing <code>/base-app/</code>. To do that, try to update the Istio Virtual Service to:</p>
<pre class="lang-yaml prettyprint-override"><code>- match:
  - uri:
      prefix: /base-app
  rewrite:
    uri: /
  route:
  - destination:
      host: svc-app
      port:
        number: 8000
</code></pre>
