How to Handle Client-Side Routing for Vite + React Router

Hi everyone,

I recently migrated a Vite + React Router app from Vercel to Fly.io, and I’m running into an issue with routing.

Issue

On Vercel, I was using the following rewrite rule in vercel.json to ensure that all routes were handled correctly by React Router:

{
  "rewrites": [
    {
      "source": "/(.*)",
      "destination": "/"
    }
  ]
}

This ensured that my React app always served index.html, allowing client-side routing to work properly.

Question: Is there a built-in way to handle React Router client-side routing in Fly.io?

No. The file server than serves your index.html should be able to do that quite simply. Just return index.html for every request.

Did you ever figure this out? I’m losing my marbles over here trying to get this to work.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.