<p>I am working on a microservice application and I am unable to connect my React to my backend api pod.</p>
<p><em>The request will be internal as I am using ServerSideRendering</em>, so when the page load first, the client pod connects directly to the backend pod. <strong>I am using ingress-nginx to connect them internally as well.</strong></p>
<blockquote>
<p><strong>Endpoint(from React pod --&gt; Express pod):</strong></p>
</blockquote>
<pre><code>http://ingress-nginx-controller.ingress-nginx.svc.cluster.local
</code></pre>
<blockquote>
<p><strong>Ingress details:</strong></p>
</blockquote>
<pre class="lang-sh prettyprint-override"><code>$ kubectl get svc -n ingress-nginx
NAME                                 TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)                      AGE
ingress-nginx-controller             LoadBalancer   10.245.81.11   149.69.37.110   80:31702/TCP,443:31028/TCP   2d1h
</code></pre>
<blockquote>
<p><strong>Ingress-Config:</strong></p>
</blockquote>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata: 
    name: ingress-service 
    annotations: 
        kubernetes.io/ingress.class: nginx 
        nginx.ingress.kubernetes.io/use-regex: 'true'
spec: 
    rules: 
        - host: cultor.dev 
          http: 
            paths:
                - path: /api/users/?(.*) 
                  backend: 
                    serviceName: auth-srv 
                    servicePort: 3000
                - path: /?(.*) 
                  backend: 
                    serviceName: client-srv 
                    servicePort: 3000
</code></pre>
<blockquote>
<p><strong>Ingress log:</strong></p>
</blockquote>
<pre><code>[error] 1230#1230: *1253654 broken header: &quot;GET /api/users/currentuser HTTP/1.1
</code></pre>
<p>Also, I am unable to ping <strong>ingress-nginx-controller.ingress-nginx.svc.cluster.local</strong> from <strong>inside of client pod</strong>.</p>
<hr />
<blockquote>
<p><strong>EXTRA LOGS</strong></p>
</blockquote>
<pre class="lang-sh prettyprint-override"><code>$ kubectl get ns
NAME              STATUS   AGE
default           Active   2d3h
ingress-nginx     Active   2d1h
kube-node-lease   Active   2d3h
kube-public       Active   2d3h
kube-system       Active   2d3h

#####

$ kubectl get svc
NAME             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)     AGE
auth-mongo-srv   ClusterIP   10.245.155.193   &lt;none&gt;        27017/TCP   6h8m
auth-srv         ClusterIP   10.245.1.179     &lt;none&gt;        3000/TCP    6h8m
client-srv       ClusterIP   10.245.100.11    &lt;none&gt;        3000/TCP    6h8m
kubernetes       ClusterIP   10.245.0.1       &lt;none&gt;        443/TCP     2d3h
</code></pre>
<hr />
<blockquote>
<p><strong>UPDATE</strong>:
Ingress logs:</p>
</blockquote>
<pre><code>[error] 1230#1230: *1253654 broken header: &quot;GET /api/users/currentuser HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
host: cultor.dev
x-request-id: 5cfd15996dc8481114b39a16f0be5f06
x-real-ip: 45.248.29.8
x-forwarded-for: 45.248.29.8
x-forwarded-proto: https
x-forwarded-host: cultor.dev
x-forwarded-port: 443
x-scheme: https
cache-control: max-age=0
upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
sec-fetch-site: none
sec-fetch-mode: navigate
sec-fetch-user: ?1
sec-fetch-dest: document
accept-encoding: gzip, deflate, br
accept-language: en-US,en-IN;q=0.9,en;q=0.8,la;q=0.7
</code></pre>

Karan Kumar
<p>This is a bug in using Ingress loadbalancer with Digitalocean for proxy to <em>connect pods internally via load balancer</em>:</p>
<blockquote>
<p><strong>Workaround</strong>:</p>
</blockquote>
<p>DNS record for a custom hostname (at a provider of your choice) must be set up that points to the external IP address of the load-balancer. Afterwards, digitalocean-cloud-controller-manager must be instructed to return the custom hostname (instead of the external LB IP address) in the service ingress status field status.Hostname by specifying the hostname in the service.beta.kubernetes.io/do-loadbalancer-hostname annotation. Clients may then connect to the hostname to reach the load-balancer from inside the cluster.</p>
<p><a href="https://github.com/digitalocean/digitalocean-cloud-controller-manager/blob/master/docs/controllers/services/examples/README.md#accessing-pods-over-a-managed-load-balancer-from-inside-the-cluster" rel="nofollow noreferrer">Full official explaination of this bug</a></p>
