Custom 404 page

I have added a 404.html file to the root of my node js app currently deployed on render. I can access the file when I use this URL @WealthAlly - Your personalized AI financial coach however I am not able to access to my custom 404 page when for example I use this URL @https://wealthally.ai/page-that-does-not-exist Please help, Thank you!

Hi there,

Assuming this is a web service, your app will need to handle the routing so that invalid routes end up going to your custom 404 page.

Regards,
Mike


Render Support Engineer, MT (UTC-6, UTC-7 in Winter)

Thanks for the reply @ Mike_Marinaro, yes it is a web service. I have created a render.yaml

services:
  - type: web
    name: wealthally
    runtime: static
    buildCommand: |
      npm run build
      cp 404.html dist/
      cp _redirects dist/
    staticPublishPath: ./dist
    headers:
      - path: /*
        name: Cache-Control
        value: no-cache
    routes:
      - type: rewrite
        source: /404
        destination: /404.html
      - type: rewrite
        source: /*
        destination: /404.html
        condition: "!exists(path)"

It still does not work

Hi there,

It looks like this blueprint is now configuring a static site? If so, then you’ll want to use routes to configure routing: https://docs.render.com/blueprint-spec#routes

You can also configure this entirely in Dashboard as well once the static site is created.

Regards,
Mike


Render Support Engineer, MT (UTC-6, UTC-7 in Winter)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.