The Everywhere Cloud

Deploy an instance.
Accelerate your application.

Solving Drupal 8 Invalid Host Name Problem in PHP

If an existing Drupal 8 encounters the error "The provided host name is not valid for this server" when using a different domain name or IP address, then the following steps may help resolve the issue.


1. In the Drupal folder, open the file that handles the Drupal settings.


2. Find the "Trusted host configuration" section and add the lines marked "TRUSTED" as follows.


 * Trusted host configuration.

$settings['trusted_host_patterns'] = [
        '^localhost$', // TRUSTED loopback host name
        '^localhost\:', // TRUSTED loopback port nums
        '^127\.', // TRUSTED loopback IPv4 addresses
        '^\[\:\:1\]', // TRUSTED loopback IPv6 address
        '\.local$', // TRUSTED mDNS top-level domain name for LAN
        '\.local\:', // TRUSTED mDNS top-level domain port for LAN
        '^192\.168\.', // TRUSTED single Class B network IPv4
        '^10\.', // TRUSTED single Class A network IPv4
        '^mydomain\.com$', // TRUSTED Internet domain name
        '\.mydomain\.com$', // TRUSTED Internet subdomain names


3. Save the file and reload the page.



Popular posts from this blog

Enabling HTTPS in Home Assistant

Configuring the FreeBSD Firewall with IPFW

Running Home Assistant on FreeBSD Servers