Drupal and reverse proxy: How to make Drupal aware that it's protocol is HTTPS? I have a reverse proxy Docker container in front a Drupal container on a Docker host.
My reverse proxy container is https://hub.docker.com/r/jwilder/nginx-proxy
The public site URL is https://ahora-stage2.dcycleproject.org
When a request is made to https://ahora-stage2.dcycleproject.org, drupal receives the following headers. I ran dpm(\Drupal::request()-&gt;headers); using devel/php on a backend web interface:
stdClass Object ( [__CLASS__] =&gt; Symfony\Component\HttpFoundation\HeaderBag [headers:protected] =&gt; Array ( [authorization] =&gt; Array ( [0] =&gt; ) [host] =&gt; Array ( [0] =&gt; ahora-stage2.dcycleproject.org ) [connection] =&gt; Array ( [0] =&gt; close ) [x-real-ip] =&gt; Array ( [0] =&gt; 216.246.250.184 ) [x-forwarded-for] =&gt; Array ( [0] =&gt; 216.246.250.184 ) [x-forwarded-proto] =&gt; Array ( [0] =&gt; https ) [x-forwarded-ssl] =&gt; Array ( [0] =&gt; on ) [x-forwarded-port] =&gt; Array ( [0] =&gt; 443 ) [content-length] =&gt; Array ( [0] =&gt; 212 ) [accept] =&gt; Array ( [0] =&gt; text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 ) [content-type] =&gt; Array ( [0] =&gt; application/x-www-form-urlencoded ) [origin] =&gt; Array ( [0] =&gt; https://ahora-stage2.dcycleproject.org ) [accept-language] =&gt; Array ( [0] =&gt; en-ca                 ) [user-agent] =&gt; Array ( [0] =&gt; Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15 ) [referer] =&gt; Array ( [0] =&gt; https://ahora-stage2.dcycleproject.org/devel/php ) [accept-encoding] =&gt; Array ( [0] =&gt; gzip, deflate, br ) [cookie] =&gt; Array ( [0] =&gt; SESS06c9cc57c2abbd62a4b35358c6967749=zmOe3Gexxxxxxxx7238990ldZb50rMxl35yPOeM ) [x-php-ob-level] =&gt; Array ( [0] =&gt; 0 ) ) [cacheControl:protected] =&gt; Array ( ) ) 

Based on that information, https://x-team.com/blog/base_url-drupal-8/, https://medium.com/@lmakarov/drupal-8-and-reverse-proxies-the-base-url-drama-c5553cbc9a3e, and comments in the settings.php file, I put these custom settings in my Drupal settings.php file:
$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = ['104.236.70.29','216.246.250.184'];

Nonetheless, Drupal always keep believing that the protol is HTTP, not HTTPS.
See enclosed image.

I'm wondering how I could set it up so that Drupal understands that it's behind a reverse proxy and that it's public URL should be served using the https protocol.
It turns out the IP which should be in the reverse_proxy_addresses is neither the IP which you get when you ping the domain, nor the ID in the headers which you can inspect. Rather, you need to temporarily install devel_php on your site, and then go to /devel/php and enter dpm($_SERVER['REMOTE_ADDR']);. This will give you a result such as 172.18.0.5, which then goes in $settings['reverse_proxy_addresses'];
More info at https://blog.dcycle.com/blog/170a6078/letsencrypt-drupal-docker/