Is it possible, on nginx, to send a Strict-Transport-Security header, even on pages that require WWW-Authentication?
When I have both auth_basic
and add_header Strict-Transport-Security "max-age=2592000";
, the HSTS header isn't sent:
$ curl -Ik https://****************
HTTP/1.1 401 Unauthorized
Server: nginx/1.4.6 (Ubuntu)
Date: Sun, 14 Sep 2014 17:56:08 GMT
Content-Type: text/html
Content-Length: 203
Connection: keep-alive
WWW-Authenticate: Basic realm="*********"
it is sent on a different page, that does not require authentication, so the add_header
directive is having effect - just not when it requires authentication.