-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Open
Labels
accepting-prsIdentifies issues/proposals that we are accepting community PRs forIdentifies issues/proposals that we are accepting community PRs forbugfeat:routerpkg:react-router
Description
I'm using React Router as a...
framework
Reproduction
- Go to https://stackblitz.com/edit/stackblitz-starters-xvygdk
- Click the "About" link inside the preview, which points to
/about/ - Notice the missing trailing slash on the rendered request.url.
- Reload the About page, notice the trailing slash now being appended to the request.url.
System Info
react-router@7.0.2 (app created using `npx create-react-router@latest`)Used Package Manager
npm
Expected Behavior
request.urlin loader to contain a trailing slash, since that's the URL I'm at.request.urlbehaving consistently no matter if I'm client side navigating or SSR.
Why is this important?
We are fetching data inside the loader, and need to pass the pathname to an API. The API responds differently depending on if certain pages have trailing slash or not (tells the client to redirect etc.). This issue leads to redirect loops and blocks us from migrating to React Router 7.
Actual Behavior
request.urlis missing a trailing slash, although that is the URL I'm at.request.urlcontains a trailing slash during SSR, but strips it during client side navigation.
ramiroazar and mattbdc
Metadata
Metadata
Assignees
Labels
accepting-prsIdentifies issues/proposals that we are accepting community PRs forIdentifies issues/proposals that we are accepting community PRs forbugfeat:routerpkg:react-router