"Redirects to external URLs are not allowed by default" in detection configuration by domain

Created on 20 December 2021, over 2 years ago
Updated 28 May 2024, about 1 month ago

Hello, in order to have the locale prefix at the beginning of the url instead of the end of the url, i have set in "admin/config/regional/language/detection/url" the part of the url that determines language by domain.
english: en.mysite.localhost
francais: fr.mysite.localhost
But when I try to delete a node: en.mysite.localhost/node/7/delete
I have an issue and the current error: β€œRedirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.”
Someone knows how to work around the problem?
I have tried to edit the settings.php and set trusted_host_patterns to ['.*'] but not working.
Thanks in advance for your help.

πŸ› Bug report
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
Language systemΒ  β†’

Last updated about 22 hours ago

  • Maintained by
  • πŸ‡©πŸ‡ͺGermany @sun
Created by

πŸ‡¨πŸ‡­Switzerland Roberto d9

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.

  • πŸ‡ΈπŸ‡ͺSweden johnzzon Gothenburg πŸ‡ΈπŸ‡ͺ

    One of our clients encountered this last week. Their setup also involves different domains for different languages.

    I could reproduce it locally by using en.localhost, fi.localhost, dk.localhost, etc.

    So I went into the code with Xdebug. What happens is that when you delete a translated node, it redirects you to the node's default translation. In a setup with different domains this means that it tries to redirect you to another domain, which is not a "SecuredRedirectResponse". This check is in \Drupal\Core\EventSubscriber\RedirectResponseSubscriber::checkRedirectUrl

    The node is deleted just fine, just that the redirect triggers an error.

    I made sure that it's reproducible using only core. It's reproducible with the standard profile installation.

    Steps to reproduce:

    1. Enable modules: Language and Content translation
    2. Configure a second language, eg. Swedish
    3. Configure Language > Detection and selection > URL to use Domain based, and add domains for each language
    4. Configure Content language and translation so that Basic page is translatable
    5. Create a node in English
    6. Translate the node to the second language
    7. Delete the second language's translation
    8. Encounter error: "Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it."
  • πŸ‡ΈπŸ‡ͺSweden johnzzon Gothenburg πŸ‡ΈπŸ‡ͺ

    Adding related issue I finally found after searching some more.

  • Status changed to Closed: duplicate about 1 month ago
Production build 0.69.0 2024