Skip to content

Custom 404 doesn't load on Cloudflare Pages #6177

Description

@JG-devo

What version of astro are you using?

2.0.6

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

Cloudflare Pages is looking for a 404.html file to handle 404 responses, however, the production build of the final files includes a 404 folder with index.html inside. This seems to happen with SSG mode and dynamic routing.

I've tested this by going to domain.com/404/ and the page loads up on Cloudflare pages. Going to domain.com/404 goes back to the home page. I've also checked the build folder (/dist) and verified this result.

Screenshot 2023-02-08 at 17 13 52

I've created a version of this bug with stackblitz linked below. Simply add /404/ to the end and try without i.e. /404

Thanks!

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-daj2vt?file=src/pages/index.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions