<p>I am working with ingress-nginx in kubernetes to set up a server.
The issue is that the paths are not routing at all and I get a 404 error from the nginx server on any request I make.
Below is my code for ingress:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-srv
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
spec:
  # defaultBackend:
  #   service:
  #     name: auth-srv
  #     port:
  #       number: 3000
  rules:
    - host: app.dev
    - http:
        paths:
          - pathType: Prefix
            path: /api/auth/?(.*)
            backend:
              service:
                name: auth-srv
                port:
                  number: 3000
          - path: /api/coms/?(.*)
            pathType: Prefix
            backend:
              service:
                name: coms-srv
                port:
                  number: 3000
</code></pre>
<p>If I uncomment the default backend service I get a response but as soon as I remove it I get the 404 nginx error. So I know its connecting to the services I set.</p>
<p>I don't know where I'm going wrong how to go about fixing this as I'm copying straight from the <a href="https://kubernetes.github.io/ingress-nginx/user-guide/ingress-path-matching/" rel="nofollow noreferrer">docs</a>. Any help or insight would be great. Thank you in advance!</p>
<p><strong>Edit 1:</strong> I removed the regex from the path and commented out the /api/auth path so no requests should be going to the auth-srv. For some reason, all requests route to the auth-srv even though there is no mapping to it. NOTE: Both the auth and coms pods/services are running in the background, just ingress-nginx still isn't routing properly.</p>

Gerry Saporito
<p>So the reason why this wasn't routing properly was because of the:</p>
<pre><code>    - host: app.dev
    - http:
</code></pre>
<p>The &quot;-&quot; in front of the &quot;http&quot; made the controller think it was its own ruleset so the following routes had a host of &quot;*&quot;. After I Removed the &quot;-&quot; in front of the &quot;http&quot;, the rules were set to the proper host of app.dev and it started routing accordingly.</p>
<p>Thank you for your help everyone! What a long day it has been :')</p>
