1

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.

2
  • load balancers? Oct 3, 2018 at 21:22
  • Yes @LittleCoding we do have load balancers, that are part of acquia infrastructure.
    – arpitr
    Oct 3, 2018 at 21:23

1 Answer 1

0

To avoid this, make sure you have an up-to-date Drupal install, adding this code to your settings.php file (or post-settings-php hook for Site Factory customers):

unset($_SERVER["HTTP_FORWARDED"]);

Source: https://acquia.my.site.com/s/article/360044285973-Troubleshooting-the-A-client-error-happened-message-in-content

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.