backdrop-ops / backdrop-pantheon

Version of Backdrop CMS that runs on the Pantheon hosting platform.
GNU General Public License v2.0
5 stars 8 forks source link

Include Pantheon dev/test/live URLs in trusted host patterns by default #41

Closed jenlampton closed 3 years ago

jenlampton commented 4 years ago

Pantheon recommends adding the following to settings.php so pantheon URLs for dev/test/live sites are included in trusted_host_patterns. I'd like to do this in the settings.php file that is included by default for Backdrop Pantheon installs.

if (defined('PANTHEON_ENVIRONMENT')) {
  if (in_array($_ENV['PANTHEON_ENVIRONMENT'], array('dev', 'test', 'live'))) {
    $settings['trusted_host_patterns'][] = "{$_ENV['PANTHEON_ENVIRONMENT']}-{$_ENV['PANTHEON_SITE_NAME']}.pantheon.io";
    $settings['trusted_host_patterns'][] = "{$_ENV['PANTHEON_ENVIRONMENT']}-{$_ENV['PANTHEON_SITE_NAME']}.pantheonsite.io";
  }
}
jenlampton commented 4 years ago

PR filed at https://github.com/backdrop-ops/backdrop-pantheon/pull/42, would love a review!

herbdool commented 4 years ago

Looks good to me.