\Drupal\Core\Routing\TrustedRedirectResponse error is thrown excessively, especially with multilingual enabled

Created on 14 July 2017, almost 8 years ago
Updated 15 February 2023, about 2 years ago

This error seems to crop up a lot when working on multiple domains that have multilingual functionality.

Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it

I believe the cause is because the content translation core functionality will redirect between nodes. If a different translation has a different domain access set on it, clicking on the node from the "Translate" tab yields this error frequently.

This even happens when the trusted host pattern is set to whitelist all of the domains properly.

If you take a look at core's Drupal\Core\EventSubscriber\RedirectResponseSubscriber class, you'll see that they specifically cause an exception when non-local redirects happen. Since domain tends to do this, the error comes up a lot.

In order to circumvent this (not sure if this is ideal, since it might not pass security review) we can extend the RedirectResponseSubscriber within domain. Perhaps the maintainer can comment if this is a good approach. I will present a patch for domain that does this.

🐛 Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

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.

Production build 0.71.5 2024