Skip to content

Instantly share code, notes, and snippets.

@gheydon
Last active October 31, 2021 08:58
Show Gist options
  • Save gheydon/bd8f28d1b94bf9dc9febc958745ed126 to your computer and use it in GitHub Desktop.
Save gheydon/bd8f28d1b94bf9dc9febc958745ed126 to your computer and use it in GitHub Desktop.
In Drupal 8 the request object is used to determine if the request is from a reverse proxy. How ever in some cases the headers X-Forwarded-* are not being transmitted correctly so Drupal can't determine if the session between the browser and the reverse proxy are not being correctly. In the case X-Forwarded-Proto is being setting to http instead…
if (PHP_SAPI !== 'cli' && $_SERVER['HTTP_X_FORWARDED_PORT'] == 443) {
$GLOBALS['request']->headers->set('X_FORWARDED_PROTO', 'https');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment