Open
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.url
in loader to contain a trailing slash, since that's the URL I'm at.request.url
behaving 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.url
is missing a trailing slash, although that is the URL I'm at.request.url
contains a trailing slash during SSR, but strips it during client side navigation.