Description
What version of React Router are you using?
6.8.0
Steps to Reproduce
- Have a react router application hosted in a sub directory e.g.
https://example.com/app1
https://example.com
andhttps://example.com/app1
are two independent applications. Served using a reverse proxy
app1
is the base path and it is set using basename
const router = createBrowserRouter(
[
{
id: "root",
path: "/",
element: (
<>
<div>Root</div>
<Link to="/logout">Logout</Link>
</>
),
},
{
path: "/logout",
loader: LogoutLoader,
},
],
{
basename: "app1",
}
);
export const LogoutLoader = async () => {
return redirect("https://example.com");
};
- Go to logout url
https://example.com/app1/logout
Expected Behavior
LogoutLoader should redirect user to https://example.com
as if it was an external redirect to somewhere like https://google.com
. It should be a redirect via browser instead of react-router.
Actual Behavior
React router changes the browser URL but the content of the site is still from https://example.com/app1
instead of https://example.com
. In the browser dev tools, no request is made to redirect URL.
Possible bug might be here
react-router/packages/router/router.ts
Line 3130 in 6120207