Skip to main content
Last Reviewed: 2022-12-13

Environment-Specific Configurations for Drupal

Manage verbose debugging options and system performance settings per environment on Pantheon using our service configuration files and Drupal's configuration override system.


This section provides information on how to manage verbose debugging options and system performance settings for individual environments.

The following instructions enable Twig debugging and set development-friendly performance options across Pantheon's pre-production environments (Dev & Multidevs). This approach prevents debugging output and potentially harmful performance settings from being deployed to staging and production environments (Test and Live).

Enable Twig Debugging on Dev & Multidevs

Pantheon handles the inclusion of service configuration files. The default file provided has everything you need, so enabling Twig debugging is simple:

  1. Clone the site's codebase using the Git command string provided on the Site Dashboard or via Terminus if you haven't done so already.
  1. Navigate to the site's docroot and rename the existing default service file for pre-production environments:
  1. Stage, commit, and push your changes to Pantheon:
  1. Clear caches on Dev within the Site Dashboard or via Terminus:
  1. Verify configuration by inspecting the page source on the Dev environment's URL. You should see markup similar to the following:

Refer to Creating a services.yml File for Drupal for more information on Pantheon's service configuration files for Drupal.

Enable Cacheability Debugging on Dev and Multidevs

  1. Add the sites/default/services.pantheon.preproduction.yml file to your project if you have not done so already.

    • This service file is used to manage settings across Pantheon's development (Dev and Multidev) environments. Settings in this file are not applied to production (Test and Live) environments.
  2. Enable Drupal's CacheableResponseInterface to help debug your cache by setting the http.response.debug_cacheability_headers parameter to true:

  3. Stage, commit, and push your changes to Pantheon:

  1. Verify service setting and debug cache behavior by inspecting response headers on a development environment URL. If enabled, cacheable responses will return X-Drupal-Cache-Tags and X-Drupal-Cache-Contexts headers such as:

Refer to Creating a services.yml File for Drupal for more information on Pantheon's service configuration files for Drupal.

Troubleshoot 503 Response: Header Overflow

Responses with HTTP headers that exceed 10k return 503 Header Overflow errors. If you get this error after enabling cacheability debugging, disable it in the appropriate service file.

This issue can be caused by a number of scenarios related to cache tags, such as many fields on a content type causing Drupal to generate really long HTTP headers. For more information on cache tags, see Cache tags.

Override System Performance Settings Per Environment

  1. Use the PANTHEON_ENVIRONMENT constant and Drupal's override system within settings.php to enforce performance configurations based on the current Pantheon server environment:
  1. Stage, commit, and push your changes to Pantheon:

  2. Verify overridden configurations for each config.name on the Dev environment within the Drupal UI using the Configuration Manager core module (/admin/config/development/configuration/single/export) or via Terminus:

    Information:
    Note

    Overridden configurations are not shown within Drupal's admin interface; this behavior is intentional.

  3. Deploy to Test and verify desired configurations are present. If everything looks good, deploy to Live.

Rotate hash_salt setting

You can use the Terminus env:rotate-random-seed command if you need to change the value for the keys and salts. This command invalidates all one-time login links and forces all users to login again.

Inclusions and Loading Order of Settings and Services Files

Settings FileInclusions
settings.phpservices.yml
settings.pantheon.php
settings.local.php
settings.pantheon.phpservices.pantheon.preproduction.yml
services.pantheon.production.yml
settings.local.php development.services.yml

More Resources