HSTS簡介
HSTS(HTTP Strict Transport Security)是國際互聯網工程組織IETF發布的一種互聯網安全策略機制。
采用HSTS策略的網站將保證瀏覽器始終連接到該網站的HTTPS加密版本,不需要用戶手動在URL地址欄中輸入加密地址,以減少會話劫持風險。
server { listen 443 ssl; server_name www.xx.com; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; }
參考:
https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/
http://www.sohu.com/a/146282947_760387