<p>I have a minimal web application running on local minikube cluster.
The backend is exposing an API at <code>/be/test/hi</code> and service name is also be.
When I send a GET request from frontend to backend i get:</p>
<pre><code>main.js:15 GET http://be/be/test/hi net::ERR_NAME_NOT_RESOLVED
</code></pre>
<p>If I run <code>nslookup be</code> from the frontend POD i get the correct dns resolution, and running
<code>curl be/be/test/hi</code> I get the right response from backend (a simple 'Hello world' string)</p>
<p>What am I missing?</p>
<p>backend.yaml</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: be
spec:
  ports:
    - port: 80
      targetPort: 8080
  selector:
    app: be
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: be
spec:
  replicas: 1
  selector:
    matchLabels:
      app: be
  template:
    metadata:
      labels:
        app: be
    spec:
      containers:
      - name: be
        image: kubebe
        imagePullPolicy: Never
        ports:
          - containerPort: 8080
</code></pre>
<p>frontend.yaml</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: fe
spec:
  ports:
    - port: 80
      targetPort: 8080
  selector:
    app: fe
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: fe
  template:
    metadata:
      labels:
        app: fe
    spec:
      containers:
      - name: fe
        image: kubefe
        imagePullPolicy: Never
        ports:
          - containerPort: 8080
</code></pre>
<p>main.js</p>
<pre><code>const URL=&quot;http://be/be/test/hi&quot;

  function httpGetAsync(){
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.onreadystatechange = function() { 
        if (xmlHttp.readyState == 4 &amp;&amp; xmlHttp.status == 200)
            console.log(xmlHttp.responseText);
    }
    xmlHttp.open(&quot;GET&quot;, URL, true); 
    xmlHttp.send(null);
}
</code></pre>
<p>frontend Dockerfile (kubefe image):</p>
<pre><code>FROM centos/httpd-24-centos7:2.4
RUN mkdir -p /var/www/html/fe
COPY ./index.html ./main.js /var/www/html/fe/
</code></pre>
<p>EDIT: I've resolved my issues but I think the actual question is still unanswered.</p>
<p>To solve this I've simple removed the protocol and host from my url and set up proxy rules in /etc/httpd/conf.d/default-site.conf</p>
<p>default-site.conf</p>
<pre><code>&lt;VirtualHost *:8080&gt; 
  ProxyPreserveHost Off
  ProxyRequests Off
  ProxyPass /be/ http://be/be/
&lt;/VirtualHost&gt; 
</code></pre>

Esotopo21
<p><strong>Your frontend code (javascript) is executing in your browser, not inside the kubernetes cluster (nginx pod)</strong></p>
<p>You have 3 options here,</p>
<ol>
<li>Create a NodePort Service for your frontend</li>
<li>Rely on kubeproxy for doing a port forward</li>
<li>Create an ingress</li>
</ol>
