404 not resolving

We wrote a redirect into our netlify.toml and built a custom 404 page in contentful, but whenever I pass a bad path to the url the page never seems to resolve. I checked the console and had the error
Uncaught Error: Missing resources for /aslkjfsdf. Below is the redirect code.

[[redirects]]
    from = "/*"
    to = "/404/"
    status = 404

Hi @el-burge, can you provide a real URL that we can test? Thanks.

Sure thing! Here’s the home site https://www.xnor.ai/ the resolved 404 https://www.xnor.ai/404/ and a bad url that should redirect to the 404 https://www.xnor.ai/badurl

Hi,

I checked https://www.xnor.ai/badurl and it looks like the domain is loading your 404 page, however, your 404 hero image isn’t rendering. That’s something you’ll have to debug in your code.

It does appear that the page redirects but the url does not change to xnor.ai/404. When you go to xnor.ai/404 the image renders properly. I’m asking why the /badurl doesn’t get converted to /404 on the redirect.

we do not intend to change the URL on a 404. It’s not a redirect - just a rewrite. We’ll serve the 404 content at the URL they asked for. If you want to do something like catch all of the missing content and direct it to a page, you could use an explicit redirect like:

/* /404.html 301

but that would not return 404 so seems suboptimal. If I were you I’d just hardcore the absolute path to your 404 assets so they always work right (we’ll show the 404.html text, but relative references will resolve as you’re seeing - relative to the /path/of/the/missing/page rather than / or /404