I'm totally new to curl and am trying to ascertain if websites use Strict-Transport-Security.
I'm running off advice. I've been told to check against Chrome's preloaded list and to run
curl -D - https://www.example.com | head -n 20
to check for Strict-Transport-Security headers.
But the 'head' command generated an error and was unknown.
Any ideas?
ATM I'm running Win XP, will have a linux distro in a few days.
Thanks.
There are a couple easy ways to check if the HSTS is working on your WordPress site. You can launch Google Chrome Devtools, click into the “Network” tab and look at the headers tab. As you can see below on our Kinsta website the HSTS value: “strict-transport-security: max-age=31536000” is being applied.
If you own a site that you would like to see included in the preloaded HSTS list you can submit it at https://hstspreload.org. You can see the current HSTS Rules -- both dynamic (set by a response header) and static (preloaded) using a tool on the about://net-internals#hsts page. Check the source for the full list.
To check this Strict-Transport-Security in action go to Inspect Element -> Network check the response header for Strict-Transport-Security like below, Strict-Transport-Security is highlighted you can see.
That method is fine.
$ curl -s -D- https://paypal.com/ | grep Strict
Strict-Transport-Security: max-age=14400
As you've noticed, some webservers just refuse to honour HEAD
requests. curl
will print the headers for a GET
request with -v
:
$ curl -s -vv https://paypal.com/ 2>&1 | grep Strict
< Strict-Transport-Security: max-age=14400
The <
means the header is one returned by the server to you.
Actual example.com
, as in your example, won't work as it doesn't listen on https://
at all:
$ curl -D- https://www.example.com
curl: (7) couldn't connect to host
As the Strict-Transport-Security
header is only honoured if it is delivered over https://
, it's very safe to assume that any site that doesn't respond to on https://
isn't using STS, especially as it would have no reason to do so.
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