This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Introducing Cloudways Community Forum. Start Discussions and Get Instant Help From Cloudways Community. JOIN NOW

Most Common Issues for DrupalJuly 31, 2017

 

In this KB

  • Hostname not valid for server
  • Duplicate modules
  • Cannot login after turning on site maintenance
  • CSS/ Theme changes not showing up

 

The Provided Hostname is Not Valid for This Server

This error message is due to a new feature in Drupal 8 that protects against  HTTP Host header attacks. Feature description is available in the change record that was generated for the patch.

A new setting $settings['trusted_host_patterns']  was added to Drupal 8 to configure a list of trusted hostnames that the site can run from. The setting needs to be an array of regular expression patterns, without delimiters, representing the hostnames you would like to allow to run from and should be updated in your application’s settings.php :

Note that ^, \., and $  are PCRE Syntax. These just mean that you want to match “www.example.com” precisely, with nothing extra at the beginning and end, and that the dots should be treated as dots and not wildcard characters.

If you are running from “example.com”, then just use:

If you need to run a site off of multiple domains and/or subdomains, and are not doing canonical URL redirection, then your setting would look something like this:

This allows the site to run off of all variants of example.com and example.org, with all subdomains included.

Once you adjust $settings['trusted_host_patterns'] to the proper value, you should be able to browse to your site again.

You can also check on the status of your trusted host settings from the status report page, which is at admin/reports/status

If you remove the setting altogether, the trusted host mechanism will not be used, and you will see an error on the status report page. Additionally, your site may also be vulnerable to HTTP Host header attacks.

Duplicate Modules

There often comes a time when a new dev release of a module you are already using is out. So, you may wish to check out the release but do not want to get rid of the stable current version. What Drupal users usually do in that case is they rename the current module version’s folder name to something like module-old and download the new dev release and install it.

When this happens, there are now two folders for the same module in the same directory, i.e module/ and module-old/. The problem with this approach is that when parsing through directories, Drupal does not differentiate between the folders containing the module and only reference to the module.info or module.info.yml file. You cannot rename this file since Drupal won’t know it is a file that it is supposed to reference. Due to this, there’s a high possibility that Drupal might reference the wrong version of the module and use it, which could potentially break the functionality of your site.

In order to avoid this, make sure that you are never using the same module in the same directory.

Cannot Login After Turning on Site Maintenance

One issue that is often asked in the Drupal forums is when users aren’t able to login after turning on site maintenance.

This can be done by going to the following URL: http://www.example.com/?q=user. (example will be replaced by your site name and user will not be changed).

CSS/Theme Changes not Showing Up

If you’ve ever altered your Drupal site’s theme or CSS, you would notice that a lot of the time, the changes you made aren’t showing up. Issues like these, when changes don’t show up, are more often due to caching.

Clear your cache via Drush commands (for details visit Drupal ver.7, ver.8) and you should see the changes.

Please insert Content
Have Questions? Ask From Our Helpful Community

Comments are closed.

Do you still need help?

Our Technical Support team is always at work.