remix
remix copied to clipboard
Broken Routing: Remix + React Router integration branch
What version of Remix are you using?
0.0.0-experimental-5b4bceda6
Steps to Reproduce
Within a Remix loader, call the redirect function with a fully qualified URL like https://google.com
Example loader:
export const loader = async ({ request }: LoaderArgs) => {
const session = await requestSession(request);
const auth = getAuthFromSession(session);
// don't try to login again if already logged in
if (auth) {
return redirect("/");
}
// this hits a 3rd party api and returns a 304 redirect response with destination
const res = await getLogin();
if (res.redirected) {
return redirect(res.url);
}
return redirect("/");
};
Expected Behavior
Calling redirect with a fully qualified url takes my user to that URL.
Actual Behavior
Calling redirect with a fully qualified url takes my user to my site url with the redirect url appended to the end
Like http://localhost:3000/https://google.com
I found the code causing this issue and wrote an integration test to verify.
I will play around with a few solutions. I assume this issue happens because in react router we mostly assume you are routing within an SPA but in remix that’s not necessarily the case.
This should be resolved in 1.8.0-pre.2
- @cephalization do you want to confirm your use-case?
Works great @brophdawg11 , thanks!
Released in 1.8.0