TanStack / TanStack/router

Hosting details for Cloudflare Workers doesn't work for single-page app on Cloudflare Pages

Open
#5,619 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
TypeScript
Stars
15.1k
Forks
1.9k
Avg merge
1d 20h
Merged PRs (30d)
143

Description

Which project does this relate to?

Start

Describe the bug

SPA (single-page app) mode isn't able to the shell properly locally or on Cloudflare Pages. This is because Pages expects the shell at /index.html and doesn't appear to accept a redirect.

Your Example Website or App

tbc

Steps to Reproduce the Bug or Issue

As per directions in docs for SPA mode

  1. Configuring SPA mode
  2. Basic Redirects Example
  3. Shell Mask Path
Expected behavior

SPA shell is transparently loaded when accessing the site root on a local or Cloudflare Pages build.

Screenshots or Videos

No response

Platform
  • Start Version: 1.133.27
  • OS: N/A, though I use Ubuntu 24.04 for dev env
  • Browser: N/A
  • Bundler: vite
  • Bundler Version: 7.1.12
Additional context

It's possible that using a dynamic routing for the root path is causing or aggravating the issue. For example:
/routes/$id.tsx

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by following the SPA mode documentation through the Basic Redirects Example and Shell Mask Path steps, including a dynamic route such as /routes/$id.tsx. Compare local behavior with a Cloudflare Pages build and verify that the SPA shell loads transparently at the site root in both environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, vite
Domain
cloud, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.