<p>My frontend pod is trying to talk to my backend pod to fetch all the users in a DB. The call is straightforward and works when I use curl inside BOTH the frontend and istio-proxy containers in the frontend pod:</p>

<pre><code>kubectl exec -it frontend-pod -c frontend-container -- bash
curl backend-svc:8000/users/
# returns correct response

kubectl exec -it frontend-pod -c istio-proxy -- bash
curl backend-svc:8000/users/
# returns correct response
</code></pre>

<p>However, my frontend react app is having trouble hitting this endpoint in Chrome. Here are the console logs:</p>

<pre><code>GET http://backend-svc:8000/users/ net::ERR_NAME_NOT_RESOLVED
</code></pre>

<p>Looks like the domain name cannot be resolved. Any idea what I'm doing wrong here?</p>

<p>I'm using nginx to serve my frontend react application (not sure if that may be a problem).</p>

<p>EDIT: Some feedback says I need to adjust my Gateway and/or Virtual service files. Here's what they look like now:</p>

<pre><code># Source: myapp/gateway.yaml
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: myapp-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
    - port:
        number: 80
        name: http
        protocol: HTTP
      hosts:
        - '*'
---
# Source: myapp/virtual-service.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: myapp
spec:
  hosts:
    - '*'
  gateways:
    - myapp-gateway
  http:
    - route:
        - destination:
            host: frontend-svc
            port:
              number: 80
</code></pre>

<p>Couple of things look wrong in your code samples:</p>

<ol>
<li>Your Istio VirtualService Routes does not match the request. Correct format would look like this:</li>
</ol>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
      name: bookinfo
    spec:
      hosts:
      - "*"
      gateways:
      - bookinfo-gateway
      http:
      - match:
        - uri:
            exact: /frontend
        route:
        - destination:
            host: frontend-svc
            port:
              number: 80</code></pre>
</div>
</div>
</p>

<ol start="2">
<li>In the same VirtualService you require a route for the backend.</li>
<li>You have to amend your frontend code to call the Gateway backend URL. This URL needs to include the external IP or Domain name of your Gateway as well as the external HTTP port. </li>
</ol>

<p>A good resource to piece these things together is the <a href="https://istio.io/docs/setup/getting-started" rel="nofollow noreferrer">Istio Getting Started Page</a></p>
