In ASP.NET Core 2.2 application we have enabled HSTS using app.UseHsts();
which adds HSTS with max-age
of 30 days in the response header.
In the fiddler
Strict-Transport-Security: max-age=2592000
Then in Chrome, if I go to chrome://net-internals/#hsts
and query our domain name, I get:
Found:
static_sts_domain:
static_upgrade_mode: UNKNOWN
static_sts_include_subdomains:
static_sts_observed:
static_pkp_domain:
static_pkp_include_subdomains:
static_pkp_observed:
static_spki_hashes:
dynamic_sts_domain: subdomain.example.com //our domain name here
dynamic_upgrade_mode: FORCE_HTTPS
dynamic_sts_include_subdomains: false
dynamic_sts_observed: 1572023505.777819
dynamic_sts_expiry: 1574615505.777818
Questions
dynamic_sts_observed
and dynamic_sts_expiry
. It does not look like it's in seconds. How is the value calculated? https://subdomain.example.com
The SSL certificate we use is wildcard certificate. *.example.com
. So HSTS configuration do i need to includeSubdomain?
like Strict-Transport-Security: max-age=2592000, includeSubDomain
It seconds in unix epoch time (I.e. since 1/1/1970). As Joachim’scommebt states you can view and convert that here: https://www.unixtimestamp.com/index.php
Yes.
It is as if you never saw the HSTS header (I.e. HTTPS will not be enforced).
After the next visit as, as per 2, it is a sliding expiration which is recalculated on each visit.
If the policy is at top level then you need to use includeSubDomains
(note with an S as you missed that in your question), for it to affect the sub domains. You can also publish a separate policy (the same one or a different one) on each sub domain. Your top level policy is only loaded if visitors go to that site (e.g. https://example.com) so if they only go to sub domain (e.g. https://www.example.com) then the browser will not cache the top level policy. Best practice is to use includeSubDomains
on all policies and to load an asset (e.g. a single pixel or maybe the company logo) from the top level domain to force that top level policy to be picked up as well so all other sub domains are protected as well. This only works if you don’t have any http-only sites (e.g. http://intranet.example.com or http://blog.example.com), in which case the best you can do is have a top level policy without includeSubDomains
and then a different policy on each sub domain that does fully support HTTPS with includeSubDomains
. The certificate as no bearing on HSTS (other than the fact you obviously need one for each domain protected!).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With