<p>I'm using kubernetes nginx ingress controller (not the nginx supported one, but the <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="nofollow noreferrer">k8s supported one</a>), with AKS (k8s version 1.17 at the moment), for which the corresponding apiversion for Ingress is <code>networking.k8s.io/v1beta1</code>, therefore using <a href="https://v1-14.docs.kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">this</a> documentation.</p>
<p>For the most basic Ingress, all fine, i.e:</p>
<pre class="lang-yaml prettyprint-override"><code># singlebackend-ingress-rule.yaml
apiVersion: networking.k8s.io/v1beta1 #  AKS is with 1.17, and supports only apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress-rules
spec:
  rules:
  - host: ingress-domain.westeurope.cloudapp.azure.com
    http:      
      paths:
      - backend:
          serviceName: backend-webapi
          servicePort: 80

</code></pre>
<p>Deployed as:</p>
<pre><code>kubectl apply -f singlebackend-ingress-rule.yaml

curl http://ingress-domain.westeurope.cloudapp.azure.com.westeurope.cloudapp.azure.com/health
200
{                                                         
   &quot;me&quot; : {                                               
      &quot;status&quot; : &quot;ok&quot;,                                    
      &quot;version&quot; : &quot;v15&quot;,                                  
      &quot;appName&quot; : &quot;Backend.WebApi&quot;,  
      &quot;aspNetCore_Environment&quot; : &quot;aks&quot;                    
   }                                                      
}                                                         
</code></pre>
<p>However, if I <strong>only</strong> add <code>backend: /api</code>, and do the exact same:</p>
<pre class="lang-yaml prettyprint-override"><code># multiplebackend-ingress-rule.yaml
apiVersion: networking.k8s.io/v1beta1 #  AKS is with 1.17, and supports only apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress-rules
spec:
  rules:
  - host: ingress-domain.westeurope.cloudapp.azure.com
    http:      
      paths:
      - backend:
          serviceName: backend-webapi
          servicePort: 80
        path: /api

</code></pre>
<p>Deployed as:</p>
<pre><code>kubectl apply -f multiplebackend-ingress-rule.yaml

curl http://ingress-domain.westeurope.cloudapp.azure.com.westeurope.cloudapp.azure.com/api/health

HTTP/2 404
server: nginx/1.19.1
date: Tue, 01 Sep 2020 09:24:36 GMT
content-length: 0
strict-transport-security: max-age=15724800; includeSubDomains
</code></pre>
<p>I get 404. What am I missing?</p>

Luis Mesa
<p>Your defined route is <code>/health</code> not <code>/api/health</code>.</p>
<p>The path you define in your <code>Ingress</code>, must be handled by your back-end server.</p>
<p>Your <code>Ingress</code> sends all your requests prefixed with <code>/api</code> to your service <code>backend-webapi</code>, but it doesn't discard the path <code>/api</code> from the route itself.</p>
<p>So, when you send request to <a href="http://ingress-domain.westeurope.cloudapp.azure.com.westeurope.cloudapp.azure.com/api/health" rel="nofollow noreferrer">http://ingress-domain.westeurope.cloudapp.azure.com.westeurope.cloudapp.azure.com/api/health</a>, your service must handle <code>/api/health</code> not <code>/health</code>.</p>
