On our multi-site platform using Drupal 8 hosted on acquia we are getting 400 error response on all the hosted websites
The error is not persistent but only occurs when user comes through a referrer like google/bing or even a link from JIRA/slack.
During this error, we see an error about 400 in Drupal Watchdog as
drupal-watchdog.log-20181003:133708:Oct 2 13:46:06 d8: https://www.example-domain.com|1538487966|php||https://www.example-domain.com/|https://www.google.com/|0||Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Untrusted Host "www.google.com". in Symfony\Component\HttpKernel\HttpKernel->handle() (line 71 of /mnt/www/html/d8/vendor/symfony/http-kernel/HttpKernel.php). request_id="v-8187594e-c649-11e8-b00d-67f570bebe6a"
As an attempt to fix the issue we tried adding 'www.google.com' in trusted_host_pattern
in settings.php
$settings['trusted_host_patterns'] = array(
'^example-domain\.com$',
'^.+\.example-domain\.com$',
'^google\.com$',
'^.+\.google\.com$',
);
but that did not fix the issue either, we are still getting errors with that same logs.
We are using varnish for reverse proxy and cloudflare, if that looks to be an issue, since that's the thing between Drupal and client request.
Any help would be much appreciated.