When a redirect is setup to point to an external URL the decoupled router does not send the information about the redirect in the response. It only provides redirect information when the redirect is internal.

The module should provide the redirect element in the response when an external redirect is available.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

johnennew created an issue. See original summary.

johnennew’s picture

Status: Active » Needs review
StatusFileSize
new653 bytes

Removing the status check appears to work for me, I expect it will need some more work.

nils.destoop’s picture

I had the same issue. Attached a patch that fixes it for me. No need to do the routermatch for external urls. If you have a redirect https://myredirect.com/ , the routematch returns the homepage.

nils.destoop’s picture

Updated patch for the 2.x version

ankithashetty’s picture

StatusFileSize
new1.22 KB
new1.3 KB

The patch in #4 is empty, so rerolled the patch in #3 against latest 2.x version.

Thanks!

ahmad-alyasaki’s picture

Version: 8.x-1.x-dev » 2.x-dev
StatusFileSize
new1.29 KB

The problem happened again to me, it's fixed with Patch Number 3, we need to first check if the URL is external. There's no need to send an external path to the Route service, For example, "mysite.com/media/news" would redirect to "example.com/news" if there's a route for "/news" in Drupal the Route service will redirect users to the same domain, ignoring the external path, That's why it's crucial to check if the path is external first. If it's not external, we can then send it to the route match. If there's no resource, just return a 404 status code.

jeffschuler’s picture

StatusFileSize
new1.25 KB
new987 bytes

Keep the return after finding an external URL, otherwise the path will continue to be parsed and (depending on the structure of the URL) not always end up including the $redirects_trace (from, to, and status) information.

Reverted back to the original comment because I believe it's more informative and correct than what it was recently changed to.

dysproseum’s picture

Updated patch to apply to 2.0.5.

krystalcode’s picture

Changes:
- The return as pointed out in #7.
- Added isExternal, I think it's useful for clients.
- Added isHomePage as well for consistency.
- Minor optimization when creating the path.
- Setting the status code when ResourceNotFoundException occurs is not needed, it's already 404 set in PathTranslatorEvent

alexpott made their first commit to this issue’s fork.

mglaman’s picture

Status: Needs review » Reviewed & tested by the community

LGTM!

  • mglaman committed e1f66386 on 2.x authored by alexpott
    Issue #3133681 by alexpott, nils.destoop, ankithashetty, jeffschuler,...
mglaman’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, all!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.