<p>I am working on a microservice app and I use nginx ingress. I setup rules with 3 services, when I mention host in the rules like this bellow it always gives me 404 for all the services</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;
    cert-manager.io/issuer: &quot;local-selfsigned&quot;
    nginx.ingress.kubernetes.io/force-ssl-redirect: &quot;true&quot;
    nginx.ingress.kubernetes.io/ssl-redirect: &quot;true&quot;
spec:
  tls:
    - hosts:
        - &quot;tradephlo.local&quot;
      secretName: tls-ca
  rules:
    - host: &quot;tradephlo.local&quot;
    - http:
        paths:
          - path: /api/main/?(.*)
            pathType: Prefix
            backend:
              service:
                name: tradephlo-main-srv
                port:
                  number: 4000
          - path: /api/integration/?(.*)
            pathType: Prefix
            backend:
              service:
                name: tradephlo-integration-srv
                port:
                  number: 5000
          - path: /?(.*)
            pathType: Prefix
            backend:
              service:
                name: tradephlo-client-srv
                port:
                  number: 3000

</code></pre>
<p>However if I put wildcard in the host under the rules it works perfectly</p>
<pre><code>rules:
    - host: &quot;*.tradephlo.local&quot;
</code></pre>
<p>I don't want to generate wildcard SSL in the production. Please help me point out what I am doing wrong here.</p>

Dave
<p>The problem is in dash <code>-</code> in the following line:</p>
<pre><code>rules:
    - host: &quot;tradephlo.local&quot;
    - http:
</code></pre>
<p>Otherwise, it is 2 different hosts - <code>tradephlo.local</code> abd <code>*</code>.</p>
<p>We can check this with the following command:</p>
<p><code>kubectl describe ing ingress-srv</code></p>
<p>And we get this:</p>
<pre><code>$ kubectl describe ing ingress-srv
Name:             ingress-srv
Namespace:        default
Address:          xxxxxxxxxx
Default backend:  default-http-backend:80 (10.60.0.9:8080)
TLS:
  tls-ca terminates tradephlo.local
Rules:
  Host        Path  Backends
  ----        ----  --------
  *
              /api/main/?(.*)   nginx:80 (yyyyy:80)
</code></pre>
<p>And we get this after removed <code>-</code>:</p>
<pre><code>$ kubectl describe ing ingress-srv
Name:             ingress-srv
Namespace:        default
Address:          xxxx
Default backend:  default-http-backend:80 (10.60.0.9:8080)
TLS:
  tls-ca terminates tradephlo.local
Rules:
  Host        Path  Backends
  ----        ----  --------
  tradephlo.local
              /api/main/?(.*)   nginx:80 (yyyyyy:80)
</code></pre>
<p>So there is no need to use wildcard, when you do this, ingress treats <code>*.tradephlo.local</code> as different host and proceeds to * rule.</p>
