why the shorter version worked
The short version couldn't have "worked". It would have been sufficient to implement HSTS, but not to have been accepted for the HSTS preload list.
Something else in your config must have been sending the complete header.
The only way to confirm what is actually going on is to record the HTTP request/response headers being sent on the request, not by the directives in your (.htaccess
?) config file.
Even the directive you posted is not necessarily sufficient by itself. You must have something that is setting the HTTPS
environment variable (this is not the same as the HTTPS
server variable). And if you have canonical redirects from www to non-www (or vice versa) then you are missing the always
argument to set the header on the 301 redirect (HTTPS only) - which is also a requirement of the "preload list".
It is far easier and less prone to error to implement HSTS "preload" in the server config. If you only have access to .htaccess
then I would be hesitant to go for "preload list" submission.
See also my answer to the following related question on CodeReview SE: