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.

Comments

Roberto d9 created an issue. See original summary.

Roberto d9’s picture

Component: configuration system » language system
avpaderno’s picture

Issue tags: -Redirects to external URLs are not allowed by default

Version: 9.2.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

johnzzon’s picture

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."
johnzzon’s picture

Adding related issue I finally found after searching some more.

undersound3’s picture

Status: Active » Closed (duplicate)