Great! Yea setting $base_url
in settings.php
tells Drupal “all links displayed in the site should use this base URL”. As described in the links posted above, this fixes “mixed content” warnings you might get from Drupal creating http
links internally.
On this Drupal Site there are 2 solutions listed as far as I understand:
Both of those chunks of code seem to be specifically for: “redirecting users to https
automatically if they come in via http
”. So that’s slightly different from the $base_url
setting above, but also useful.
Personally, I wouldn’t use either of those approaches in your case, though, because you are using a reverse proxy that terminates the SSL and then forwards traffic to the Drupal site via HTTPS. Those redirects would be better configured in the reverse proxy itself, if you can. But they aren’t critical - they just automate the redirect to https
. You could also just be sure you’re always visiting the site via https
yourself, or use a browser plugin like HTTPS Everywhere. (Personally I would prefer to automate it in the reverse proxy though.)
May be my case is special, since my reverse proxy (traefik) already enforces redirects to https.
Oh I just read this part! Then yes you don’t need to worry about it! 
As @mstenta said the settings.php and .htaccess are not in the container but in the volume.
Small correction to this: settings.php
is in the volume, but .htaccess
is NOT! It’s in the webroot, which is one directory up from the sites
volume directory.
I tried above modifications with .../sites/default/files/.htaccess
Ah… so there are actually multiple .htaccess
files in a Drupal setup… there is the “root” one which is in the root Drupal directory (webroot). That’s where you would need to make changes to redirects (if you needed to).
The .htaccess
in sites/default/files
is SPECIFICALLY for adding additional security access controls to the files
directory, which is where uploaded files are stored. This prevents things like executing malicious code that may have been uploaded.
For me it works now with $base_url being set. I wanted to give more details for other users facing the same issue.
Thanks @PDorfFarm - it sounds like you found the right solution! Thanks so much for documenting your process here! It will certainly be helpful to others.
And if anyone is interested in helping to write a “how to” on farmOS.org for setting up your own SSL, let me know!