Cloudflare Pages routes /* to main page

For Workers & Pages, what is the name of the domain?

chatcore.org

What is the error number?

What is the error message?

What is the issue or error you’re encountering

All paths after the domain, even non existing ones are routed to the root of the domain.

What steps have you taken to resolve the issue?

Checked locally and it works

What are the steps to reproduce the issue?

Make a brand new, clean Astro starter. Put it in a GitHub Repo, add that repo to Cloudflare pages.

Now every possible path is getting the content of /index.html

For example:
https://chatcore.org/a/b/c
https://chatcore.org/fake_path
https://chatcore.org/robots.txt

These all return exactly the same, as /. Basically making duplicate content on every single path.
How can I turn this behaviour off in Cloudflare Pages? The local Astro setup correctly returns 404s and the static build only generates a single index.html
There is nothing else, my example so far is 100% identical to the Astro starter, with a line of text changed.

Have you added a 404 page to your project? Cloudflare’s default behaviors for pages is documented here: Serving Pages · Cloudflare Pages docs

2 Likes

Great, it fixed it. Interestingly I have an other website on Pages, and that worked without needing a 404. It has multiple static html files, probably that is detected somehow, even though a 404 is not present.

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