Error. Redirects to relative path in the actions are not working, the are made absolute
See original GitHub issueWhat version of Remix are you using?
1.5.1
Steps to Reproduce
- Create a nested route with a button that calls the action. For instance
/admin/login
- In the action do a redirect with a relative path, for instance
export const action = async () => redirect("relative");
- The redirection is made to “/relative” instead of to
/admin/relative
or/admin/login/relative
import type { ActionFunction } from "@remix-run/node";
import { redirect } from "@remix-run/node";
import { Form, Link } from "@remix-run/react";
export const action: ActionFunction = async ({ request }) => {
return redirect("relative");
};
export default function ExamplePage() {
return (
<>
<Link to="relative">Go to relative with Link</Link>
<Form method="post">
<button type="submit">Go to relative with Action</button>
</Form>
</>
);
}
Expected Behavior
The redirections in an action to a relative path are made relative and not absolute.
Actual Behavior
The redirections in an action to a relative path are made absolute.
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
htaccess: relative paths not working properly - Stack Overflow
The first problem is that %{REQUEST_URI} always includes the full path. So, your condition could be changed to:
Read more >Relative URL is relative to wrong absolute URL on web
The problem is that you have somehow not added a trailing slash to the first URL. If this directory actually exists on your...
Read more >Paths explained: Absolute, relative, UNC, and URL—Help
Absolute and relative paths in ArcMap When you create an ArcMap (or ArcScene or ArcGlobe) document, you can specify that paths will be...
Read more >Configure Hosting behavior | Firebase Hosting - Google
Use a URL redirect to prevent broken links if you've moved a page or to shorten URLs. ... This URL can be a...
Read more >Chaining Absolute And Local Redirects With The Router In ...
In other words, if your route configuration performs an absolute redirect, then no local redirects in the subsequent route will be honored.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
CI ran and it’s failing, perfect 👌🏼
Closing this issue in favor of the bug-PR
Created