<p>So I've been trying to fix this for days now and I'm beyond stuck.</p>
<p>My app is running, and I can access the site when I go to the default url (example.com). I can refresh on this url without issues, and I can navigate through the pages being rendered through react router as long as I don't refresh on any other page. (e.g.) refreshing on example.com/path1 doesn't work, I get a 404 error.</p>
<p>My current ingress file looks like:</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: myApp-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: letsencrypt-prod
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
spec:
  tls:
    - hosts:
        - my.app.com
      secretName: myApp-tls
  rules:
    - host: &quot;my.app.com&quot;
      http:
        paths:
          - pathType: Prefix
            path: /.*
            backend:
              service:
                name: myApp
                port:
                  number: 80
</code></pre>
<p>I've added many of the most common replies to issues such as this, but it only makes matters worse, such as white screen with &quot;Unexpected token '&lt;'&quot; errors for all javascript files it tries to load, and none of the pages loading at all.</p>
<p>For example, I've tried:</p>
<pre><code>    nginx.ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/rewrite-target: /$1
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/configuration-snippet: |
      try_files $uri $uri/ /index.html;
</code></pre>
<p>I've tried adding additional paths to the controller for each route available in the app, I've tried setting the path to just &quot;/&quot; or &quot;/(.*)&quot;, nothing is working.</p>
<p>Any help would be greatly appreciated! thank you!</p>
<p>EDIT:</p>
<pre><code># latest active node image
FROM node:14-alpine

# Create app directory
RUN mkdir /app
RUN mkdir -p /app/node_modules &amp;&amp; chown -R node:node /app

WORKDIR /app

COPY package.json /app
COPY tsconfig.json /app
COPY webpack.config.js /app
COPY .env.prod .env
ADD src /app/src
ADD dist /app/dist
RUN mkdir -p /app/dist/js &amp;&amp; chown -R node:node /app/dist/js

ADD server /app/server
ADD assets /app/assets
ADD config /app/config

ARG NPM_TOKEN
COPY .npmrc_docker .npmrc
RUN npm cache verify
RUN npm install
RUN npm run build:prod
RUN rm -f .npmrc

# Expose necessary port
EXPOSE 3000

# Compile typescript and start app
CMD [&quot;cross-env&quot;, &quot;NODE_ENV=production&quot;, &quot;PORT=3000&quot;, &quot;ts-node&quot;, &quot;server/server&quot;]
</code></pre>
<p>I've also tried doing it with <code>CMD [&quot;npx&quot;, &quot;http-server&quot;, &quot;./dist&quot;, &quot;-p&quot;, &quot;3000&quot;]</code> since the server part is only doing the following:</p>
<pre><code>      this.app.use(express.static(path.resolve(__dirname, &quot;../dist&quot;)));
      this.app.get(&quot;*&quot;, (request: express.Request, response: express.Response) =&gt; {
        response.sendFile(path.resolve(__dirname, &quot;../dist/index.html&quot;));
      });
</code></pre>

Thomas Colbert
<p>Alright, so I found the real problem.</p>
<p>My domain uses both DigitalOcean and Microsoft name servers. I had the A record added on DO, but I guess it needs to be on both. So I added the A record to the other and now my config in my question works perfectly.</p>
