-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Which project does this relate to?
Router
Describe the bug
Hi community,
I'm using https://github.com/cloudflare/templates/tree/main/vite-react-template to create a project.
And try to introduce tanstack router in it, for file-based routing.
Since I'm building an mobile-first app, so I need to test in my real phone.
I used pnpm dev --host i.e. vite --host to expose network access from my computer, so that my phone can use my computer's IP and port to visit the website.
However, when I visit the network address, and route to the about page, and then do a hard refresh (press F5), the app throws a 404 error.
But when using localhost:5173, there's no such problem. Only using the IP will cause this problem.
Since this template involves Vite + React + Cloudflare Workers + Tanstack Router, I really have no idea which part is causing this problem.
Can you help me troubleshoot this issue? Thank you so much.
Your Example Website or App
https://github.com/KyleRicardo/vite-tanstack-router-template
Steps to Reproduce the Bug or Issue
- Clone my minimal reproduction repo.
- You may need to delete
pnpm-lock.jsonfirst to get Cloudflare'sworkerdworking for your machine's arch. - Run
pnpm install - Use
pnpm dev --hostto start dev server - Use
<your_local_ip>:5173to visit the dev website - Use the
aboutbutton to navigate to about page - Refresh the page, and you will get
404 Not Founderror message
Expected behavior
When directly visiting localhost:5173/about, the page works fine.
But directly visiting <your_local_ip>:5173/about, will get 404 Not Found error page.
The behavior should be exactly the same.
Screenshots or Videos
Platform
- Router / Start Version: 1.141.6
- OS: macOS, Windows
- Browser: Chrome
- Browser Version: 143.0.7499.41
- Bundler: Vite
- Bundler Version: 6.0.0 (7.3.0 tested, also same issue)
Additional context
I tried using pnpm preview --host, also get same 404 not found error, so I wonder if this is vite's issue. I may raise an issue there and cross ref this one. Thanks.

