Forum Moderators: rogerd & travelin cat
Header set Strict-Transport-Security "max-age=300; includeSubDomains" env=HTTPS [edited by: phranque at 10:23 pm (utc) on Feb 15, 2021]
[edit reason] unlinked urls [/edit]
My only comment is that I don't know where you got that rewrite, there are many simpler examples here on the forums so you don't need to have a separate rule just for https and another one for www
Redirect from HTTP to HTTPS on the same host, if you are listening on port 80.
Any comment on this?
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} !(^www\.example\.com$)? [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] An HSTS Host MUST NOT include the STS header field in HTTP responses conveyed over non-secure transport.
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" env=HTTPS
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" "expr=%{HTTPS} == on" [edited by: phranque at 12:01 am (utc) on Feb 16, 2021]
Hm... still not working...
Hm... still not working... I will have to pay someone to have a look at it.
I tried entering the simple line of code and it didn't work
I think that maybe the error is that http:// is first redirecting to https://www and not https//.domain
i'm not entirely sure how this works because i've never had the problem myself, but because you've started using a high number like 31536000, rather than starting low like 300, your browser is going to carry on requesting https from your site for the next 12 months, even if you change it back to http.
NOTE: A max-age value of zero (i.e., "max-age=0") signals the UA to cease regarding the host as a Known HSTS Host, including the includeSubDomains directive (if asserted for that HSTS Host).
...
Examine all subdomains (and nested subdomains) of your site and make sure that they work properly over HTTPS.
Add the Strict-Transport-Security header to all HTTPS responses and ramp up the max-age in stages, ...
During each stage, check for broken pages and monitor your site's metrics (e.g. traffic, revenue). Fix any problems that come up and then wait the full max-age of the stage before you move on. For example, wait a month in the last stage.
Once you're confident that there will be no more issues, increase the max-age to 2 years and submit your site to the preload list:
...
If you have a group of employees or users who can beta test the deployment, consider trying the first few ramp-up stages on those users. Then make sure to go through all stages for all users, starting over from the beginning.
...
If you maintain a project that provides HTTPS configuration advice or provides an option to enable HSTS, do not include the preload directive by default. We get regular emails from site operators who tried out HSTS this way, only to find themselves on the preload list by the time they find they need to remove HSTS to access certain subdomains. Removal tends to be slow and painful for those sites.
It's great to support HSTS preloading as a best practice, and for projects to provide a simple option to enable it. However, site operators who enable HSTS should know about the long-term consequences of preloading before they turn it on for a given domain. ...
Be aware that inclusion in the preload list cannot easily be undone. Domains can be removed, but it takes months for a change to reach users with a Chrome update and we cannot make guarantees about other browsers. Don't request inclusion unless you're sure that you can support HTTPS for your entire site and all its subdomains in the long term.
...