Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error for live pantheon sites after update (to 1.18.1?) #46

Closed
jenlampton opened this issue Mar 25, 2021 · 3 comments · May be fixed by #47 or #61
Closed

Fatal error for live pantheon sites after update (to 1.18.1?) #46

jenlampton opened this issue Mar 25, 2021 · 3 comments · May be fixed by #47 or #61

Comments

@jenlampton
Copy link
Member

I notice that we introduced to set trusted host patterns for pantheon domains:

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";
  }
}

The problem with this is that it can cause immediate downtime for live sites, after updating to the version where this was added.

From a client:

After that update the live site (that is not on the default pantheon URL) stopped working with an error, trusted_hosts_pattern. We had to add the live domain to the trusted hosts pattern to bring the site back up. Before we had not configured that at all, so i guess all URL's worked. Now not.

I think we need to add an if isset($settings['trusted_host_patterns']) before we add the pantheon domains, so that this setting remains optional for sites that didn't have any domains defined before.

@jenlampton
Copy link
Member Author

This surprised me a little because I wasn't expecting pantheon to apply changes to the settings.php file in an update, but it looks like it does.

@herbdool
Copy link
Contributor

According to https://github.com/pantheon-systems/drops-8/blob/233160dc7e502f9742f87dc710cac43afa813c7f/sites/default/settings.pantheon.php#L179 we can just allow all domains and this would avoid the headache:

/**
 * "Trusted host settings" are not necessary on Pantheon; traffic will only
 * be routed to your site if the host settings match a domain configured for
 * your site in the dashboard.
 */
if (isset($_ENV['PANTHEON_ENVIRONMENT'])) {
  $settings['trusted_host_patterns'][] = '.*';
}

@herbdool
Copy link
Contributor

@jenlampton I've got a new PR. Pantheon says trust_host_patterns not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment