I tried to install the HSTS header in my htacces file and tested it on the HSTS site (
https://hstspreload.org/). I got the following error:
"Error: HTTP redirects to www first`
http://mysite.nl` (HTTP) should immediately redirect to `
https://mysite.nl` (HTTPS) before adding the www subdomain. Right now, the first redirect is to `
https://www.mysite.nl/`. The extra redirect is required to ensure that any browser which supports HSTS will record the HSTS entry for the top level domain, not just the subdomain."
It seems the default MODX htaccess redirects domains first to www/non-www, and then to https. It should be the other way around to get the HSTS header working.
I found this explanation:
"We should redirect HTTP requests to their HTTPS equivalent before any canonicalization steps (adding or removing “www”), and send the HSTS header from any domain or subdomain that is meant to be only accessible over HTTPS:"
(
https://www.sentinelstand.com/article/http-strict-transport-security-hsts-canonical-www-redirects)
Anyone got a clue?