Every path serves index.html

Hi, I've just set up Cloudflare Pages for the first time, coming from past experience with Netlify, GitHub Pages, etc. As far as I can tell everything is configured correctly and my site serves requests... except that the path is totally ignored. So, every request serves the index.html response, even ones that do not correspond to any valid file that's been uploaded. So, for example, https://mothers-day-2024.pages.dev/this-page-does-not-exist is serving the same content as https://mothers-day-2024.pages.dev/index-v1.5.2.css which is the same as https://mothers-day-2024.pages.dev - they all match the index.html that I uploaded. I have no idea what could cause this. I have been looking through other settings on my Cloudflare account in search of things like page rules, caching configurations, and the like, but I haven't found anything that seems like it could be relevant, nor are any of the items from the Cloudflare Pages debugging guide relevant. Pages domain is mothers-day-2024.pages.dev, account ID is 6e22aeaceaa58829267b9c098f44bb08. I am attaching a screenshot showing the uploaded assets exist as far as Cloudflare is concerned, it just... doesn't serve them, except for the index.html.
No description
3 Replies
Radon Rosborough
Radon RosboroughOP9mo ago
Well, I guess all I needed was a rubber-duck here. It seems that Cloudflare always returns the index page when a page isn't found. That seems like a bug to me... at the very least, it should obviously return that with a 404 status code, not 200. But, all my prior testing of valid paths was apparently erroneous, when I request https://mothers-day-2024.pages.dev/index-v1.5.2.css it works fine. I could swear I did that before, but I guess not. Now, how do I mark this as solved...?
James
James9mo ago
If you add a 404.html, it’ll work as you expected originally. By default, pages does SPA mode where everything that doesn’t match an asset gets routed to the index
Radon Rosborough
Radon RosboroughOP9mo ago
Aha. I see: https://developers.cloudflare.com/pages/configuration/serving-pages/#single-page-application-spa-rendering Well, that is a different default than I am used to, but I cannot say it was not documented. If you were deploying an SPA, then the 200 response would of course make sense.
Want results from more Discord servers?
Add your server