Drupal 8 - Saving Bootstrap theme causes error: A client error happened

By xngo on June 15, 2019


In Drupal 8, when you are trying to save a Bootstrap theme, it displays the error message: "A client error happened". When looking at the Report for error log message, you will see the following message:

Symfony\Component\HttpKernel\Exception\BadRequestHttpException: Untrusted Host "cdn.jsdelivr.net". in Symfony\Component\HttpKernel\HttpKernel->handle() (line 71 of /home1/openwrit/public_html/opw/vendor/symfony/http-kernel/HttpKernel.php).


The error message occurred because your Trusted Host settings is enabled but you didn't include the hosts that Bootstrap are using: jsdelivr.net and cloudflare.com. To fix this, include them as trusted hosts in ./sites/default/settings.php like the followings:

$settings['trusted_host_patterns'] = array(

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.