Acquia Cloud automatically configures Drupal to run behind a reverse proxy, and most sites will not need to customize this configuration.
If you do need to adjust the default settings, we recommend using a specific format in order to ensure compatibility with different versions of Drupal and Symfony.
For example, to configure Drupal to trust the X-Forwarded-Host header, add this snippet after the Acquia include in settings.php:
// Trust the X-Forwarded-Host header.
if (isset($settings['reverse_proxy_trusted_headers'])) {
$settings['reverse_proxy_trusted_headers'] |= \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_HOST;
}
else {
$settings['reverse_proxy_host_header'] = 'X_FORWARDED_HOST';
}This should cover both the older and newer formats.
Important Note
Please note that these configurations are only relevant to Drupal 8 (and later). There is no native support for custom reverse proxy header handling in previous versions of Drupal.