I am looking up the behavior of HSTS on both HTTP and HTTPS websites, and their HTTP and HTTPS embedded resources. My understanding is that if an HSTS response header has been passed on by the server in an HTTPS response, or if the site's name is present on the HSTS preload list, then all the resources of that request would be sent on HTTPS.
However, while inspecting some sites via the Firefox Web Inspector, I am noticing some discrepancies. For example, here on cnn.com
(an HTTP website), some of the requests of doubleclick.net
's subdomains are going over HTTP, even though it is present in the HSTS preload list over here (with include_subdomains:true).
Just to test whether the root domain was sending the HSTS header, I navigated to the ad.doubleclick.net
link in the location address bar which directed me to Double Click's main site https://www.doubleclickbygoogle.com
Over here the HSTS header is being sent:
Yet, there is no effect on doubleclick
's requests on cnn.com
when I reload:
Another interesting thing is that when I try to locate the source tag of request on the DOM by going to the Inspector tab, there is no such tag with http://ad.doubleclick.net
(strung with some querystrings). The "Cause" and "Type" heading in the inspector seem to indicate its some tracker sort of a pixel.
Does anyone have any idea what could be going on over here?
secureupload.g.double.click.net
ordoubleclick.net
(I strongly suspect the former).https://doubleclickbygoogle.com
wouldn't it?includeSubDomains
directive. If the main domain gives you HSTS with IncludeSubDomains that would be the case. But it does not need to be. A subdomain can set HSTS for itself, and other domains at the same level will not get it. (I'm 80-90% sure of that, need to do more RFC reading)When establishing an HTTP connection to a given host, however instigated, the UA examines its cache of Known HSTS Hosts to see if there are any with domain names that are superdomains of the given host's domain name. If any are found, and of those if any have the includeSubDomains directive asserted, then HSTS Policy applies to the given host. Otherwise, HSTS Policy applies to the given host only if the given host is itself known to the UA as an HSTS Host
code
formatting.