Skip to content

Forcing HTTPS behind TLS termination for Drupal 8/9 #63

Description

@stevenlafl

Alt title: How to force Drupal 8/9 to output HTTPS URLs when using an nginx reverse proxy


Insert into settings.php

$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = array($_SERVER['REMOTE_ADDR']);

And forward appropriate headers with nginx config

proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;

Or with apache in mod_headers.c section

RequestHeader set X-Forwarded-Proto https
RequestHeader set X-Forwarded-Port 443

Thanks @jeffbeagley

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions