Files from previous deploys are being served in SPA mode

We recently migrated our app from Nextjs to Vite. The Nextjs version of the site provided HTML files for each page within the site, e.g. /history.html. The Vite version does not; it only provides /index.html. My read of the documentation (Serving Pages · Cloudflare Pages docs) is that the expected behavior would be that /index.html is served for access to a page like /history.

However, in practice, an old version of the HTML from the Next deployment was served instead. This contained references to Javascript files that were no longer available, causing the entire site to fail to load.

I worked around this by manually copying index.html to /history.html and other necessary locations. However, ideally, we’d like to original SPA behavior to kick in, and to guarantee that old versions of the site are never served once a new deployment comes through.