Overview

I was running Drupal with HTTPS using Docker + Traefik, as introduced in the following article.

At the time, with Drupal’s default settings, URLs were set with http as shown below.

The problem with this was that, for example, when setting up Google account login as described in the following article, the redirect URL started with http, while the Google Cloud console requires URLs starting with https. This discrepancy caused authentication to fail in some cases.

https://drupalfan.com/【drupal】googleアカウントでログインできるようにする/

This article notes the solution to this problem.

Method

The following article was helpful.

https://www.58bits.com/blog/canonical-urls-https-and-drupal-89-reverse-proxy-settings

By adding the following 3 lines, Drupal internally uses URLs starting with https.

$$$ssseeettttttiiinnngggsss[[['''rrreeevvveeerrrssseee___ppprrroooxxxyyy'__]atdr=dursTetRseUsdEe_;sh'e]ad=erasr'r]ay=($\_SSyEmRfVoEnRy[\'CRoEmMpOoTnEe_nAtD\DHRt't]p)F;oundation\Request::HEADER_X_FORWARDED_FOR|\Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PROTO|\Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PORT;

Summary

There may be aspects I haven’t fully considered, but I hope this serves as a helpful reference.