Missing redirect

Created on 3 April 2019, over 5 years ago
Updated 29 November 2023, 12 months ago

Problem/Motivation

Imagine the following state:
We have node/10 with the following aliases alias-1 and alias-2.

When requested /router/translate-path?path=/alias-1, there is a redirect section with alias-2.
When requested /router/translate-path?path=/node/10, there is no redirect section.

The issue is that Drupal's routing behavior is different in this way:

  • Opening alias-1 redirects to alias-2.
  • Opening node/10 redirects to alias-2.

Essentially this is the path alias, and not a redirect in Drupal, so decoupled router is not showing the redirect section (in it's current implementation).

In a decoupled scenario we should consider marking this as a redirect here.

Possible workaround on client side:
Once we get the resolved path and it is different than the requested one for route translation, do a redirect.
Though the response is not hinting the need for it in any way.

Proposed resolution

1. Have path aliases added in consideration for redirects section in the router.
2. Have a reasonable explanation why not and documented in the module's README file.

Remaining tasks

Discussion
(eventually) Patch.
... And the rest.

User interface changes

None.

API changes

Show the redirect section when resolving canonical paths that have aliases.

Data model changes

None expected.

Release notes snippet

TBD.

🐛 Bug report
Status

Active

Version

1.5

Component

Code

Created by

🇧🇬Bulgaria ndobromirov

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Plus 1 to this. Querying a node id resolves correctly but lacks the redirect element in the response. I note that when navigating to a node ID in Drupal it sends a 301 response to the browser if there is an alias set and I would hope to get the same behaviour when decoupled.

Production build 0.71.5 2024