Drupal Version
9.1.5
Domain module version
1.0.0-beta5
Expected Behavior
Sometimes we need to setup domain records where we don't have control over the actual domain yet (e.g. the old site still runs on it and it's only on day X to switch domains and before you want your editors create all the content, or the domain still needs to be registered).
I marked this as a support request to learn if there is a recommended workaround for this. I think the scenario described above is not too unusual. I currently don't see an option to e.g. to mark a domain alias as main domain so that the redirect would point to a valid temporary domain until we launch the site on the final domain. If there was, then the site builder would be responsible to set this up properly, I'd say.
Actual Behavior
Let's say domain2 still points to another server, but we already set it up as domain record:
If an editor selects domain2 as domain source of a node and saves it, we are seeing a WSOD which says:
Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.
On another occasions (where the domain record is not properly configured, I haven't figured out what is wrong exactly or if it is just not yet known to DNS) I got a backtrace and the error was not a WSOD but displayed on the page - however I can't reproduce this scenario:
User error: Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it. in Drupal\domain_source\EventSubscriber\DomainSourceRedirectResponseSubscriber->checkRedirectUrl() (line 60 of modules/contrib/domain/domain_source/src/EventSubscriber/DomainSourceRedirectResponseSubscriber.php).
Drupal\domain_source\EventSubscriber\DomainSourceRedirectResponseSubscriber->checkRedirectUrl(Object, 'kernel.response', Object)
call_user_func(Array, Object, 'kernel.response', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.response') (Line: 191)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 245)
Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object, Object, 1) (Line: 91)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 706)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
- Enable domain_source
- Configure domain record 1: domain1.org properly
- Configure domain record 2: Let domain2.org point to some other server (or enter a random domain)
- From domain1.org, on node add or edit form select domain2.org as domain source
- Save node, system tries do redirected to domain2.org/node/1 which fails with WSOD