Workers SPA to serve nearest index.html

Would it be possible to make worker serve nearest index.html instead of root index.html when hitting a SPA route with "not_found_handling": "single-page-application"? For example for this file structure:
/index.html
/app/index.html
/index.html
/app/index.html
When requesting something like domain.com/app/user/123 I'd like /app/index.html Another approach would be to serve a specific predefined index.html instead of root. But I can't find anything about how to make this possible while still serving static assets without worker invocation.
1 Reply
Carlos Alberto
Carlos Alberto5mo ago
Connect your favorite AI in your IDE to cloudflare's CLI and MCP. It will figure out most problems. Add context7 MCP for good measure.

Did you find this page helpful?