question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error. Redirects to relative path in the actions are not working, the are made absolute

See original GitHub issue

What 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.

Jun-03-2022 00-39-41

Actual Behavior

The redirections in an action to a relative path are made absolute.

Jun-03-2022 00-40-05

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
machourcommented, Jun 3, 2022

CI ran and it’s failing, perfect 👌🏼

Closing this issue in favor of the bug-PR

0reactions
luispuigcommented, Jun 3, 2022

Created

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found