Serving SPA in subdirectory

I know you can serve a SPA (single-page application) in the root of the Pages deployment, if you don't have a 404.html in the root (https://developers.cloudflare.com/pages/configuration/serving-pages/#single-page-application-spa-rendering).

However, I want to have normal page serving behaviour for the root and most of the site, but have SPA style page serving in a specific subdirectory (e.g. example.com/spa/) - so that any request URL that begins with /spa/* responds with /spa/index.html without redirecting. How could I achieve this?
Was this page helpful?