<p>Ingress Nginx controller is returning 404 Not Found for the React application. I narrowed it down to the React app because if I try to hit posts.com/posts, it actually returns the JSON list of existing posts, but for the frontend app it keeps showing
GET <a href="http://posts.com/" rel="nofollow noreferrer">http://posts.com/</a> 404 (Not Found)</p>
<p>I looked to some other stackoverflow questions, to no avail unfortunately.</p>
<p><strong>ingress-srv.yaml</strong></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;use&quot;
spec:
  rules:
    - host: posts.com
      http:
        paths:
          - path: /posts/create
            pathType: Prefix
            backend:
              service:
                name: posts-clusterip-srv
                port:
                  number: 4000
          - path: /posts
            pathType: Prefix
            backend:
              service:
                name: query-srv
                port:
                  number: 4002
          - path: /posts/?(.*)/comments
            pathType: Prefix
            backend:
              service:
                name: comments-srv
                port:
                  number: 4001
          - path: /?(.*)
            pathType: Prefix
            backend:
              service:
                name: client-srv
                port:
                  number: 3000

</code></pre>
<p><strong>client-depl.yaml</strong></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-depl
spec: 
  replicas: 1
  selector:
    matchLabels:
      app: client
  template:
    metadata:
      labels:
        app: client
    spec:
      containers:
        - name: client
          image: brachikaa/client
          imagePullPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  name: client-srv
spec:
  selector: 
    app: client
  ports: 
    - name: client
      protocol: TCP
      port: 3000
      targetPort: 3000
          
</code></pre>
<p>frontend <strong>Dockerfile</strong></p>
<pre><code>FROM node:alpine

ENV CI=true

WORKDIR /app
COPY package.json ./
RUN npm install
COPY ./ ./ 

CMD [&quot;npm&quot;, &quot;start&quot;]
</code></pre>
<p><strong>Logging the pod:</strong></p>
<pre><code>Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  11m   default-scheduler  Successfully assigned default/client-depl-f7cf996cf-cvh6m to minikube
  Normal  Pulling    11m   kubelet            Pulling image &quot;brachikaa/client&quot;
  Normal  Pulled     11m   kubelet            Successfully pulled image &quot;brachikaa/client&quot; in 42.832431635s
  Normal  Created    11m   kubelet            Created container client
  Normal  Started    11m   kubelet            Started container client

</code></pre>
<p>If you need any other logs, I will gladly provide them. Thanks.</p>

Mehmed Duhovic
<p>so the issue was a really dumb one - I actually set nginx.ingress.kubernetes.io/use-regex: &quot;use&quot; instead of nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;... After three days of checking through the documentation, I finally found it. If anyone encounters a similar problem - there you have it.</p>
