HSTS means HTTP Strict Transport Security, and makes browsers force your visitors over https. Why do you need this when you already have redirected your site to SSL?
HSTS is meant for situations when users are not actually visiting your site, but a site that is pretending to be your site, and therefore does not have an SSL certificate. So this fake site won’t have a redirect to SSL!
Let’s say a user is in a public place on wifi, and visits your site, domain.com. But a hacker is on the network, and is directing the user to a fake site, domain.com. It has the same domain, looks the same, but carries a virus. It doesn’t have an SSL certificate. The user will not suspect anything, and will be infected.
If you had enabled HSTS on your site however, and this user has visited your site before, the browser will remember it should go back to https. As the fake site does not have an SSL certificate, the user can’t visit the site, and will be safe.
Browsers will remember this setting for a year, so reverting back to http is difficult (which is by design of course). If you want to deactivate HSTS for your site, read this article how to clear it from your browser as well.
HSTS preload list
While HSTS is a good thing, there’s still the situation where the user has never visited your site before. In this case, the user could still request your site by http. To prevent this, the preload list had been created. All sites that are accepted onto this list get preloaded in the browsers that support this. So if a user opens your site in his browser, the browser already knows it has to request it over SSL.
When this setting is enabled, you can submit your site to the preload list by clicking the “submit site” button.
But take care! Do not submit your site without knowing exactly what the consequences are.
- Removing is difficult so only add it if you plan to stay on SSL
- All subdomains will be forced over SSL as well. Even if they are on a different server. They’re in the preload list now!
Often occurring issues
- includeSubDomains not included
If you see the notice on hstspreload.org that subdomains are not included in the header, please check if you have enabled the HSTS preload option in settings/ssl/settings.
- https redirect bypasses either www or non www domain.
If you have this issue, in the case of the primary domain on www, please remove the redirect that redirects directly from http:// to https://www, and make sure it can follow the redirect chain http:// => https:// => https://www
- Double HSTS header on domain
Possible there’s a custom HSTS header in your .htaccess, or your hosting company has enabled HSTS as well. Please remove or deactivate the other HSTS header to resolve the issue.