木禾

Warning: Unnecessary HSTS header over HTTP 的解决方法
在申请加入HSTS Preload List时,遇到Warning: Unnecessary HSTS heade...
扫描右侧二维码阅读全文
07
2019/05

Warning: Unnecessary HSTS header over HTTP 的解决方法

在申请加入HSTS Preload List时,遇到Warning: Unnecessary HSTS header over HTTP的解决方法。

Nginx

修改配置文件为如下所示:

map $scheme $hsts_header {
    https   "max-age=31536000; includeSubDomains; preload";
}

server {

......(others)

  add_header Strict-Transport-Security $hsts_header;

......(others)
}

修改后重启Nginx

Apache

修改配置文件为如下所示:

<VirtualHost *:443>

......(others)

    Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"


......(others)
</VirtualHost>

修改后重启Apache

References

Last modification:July 7th, 2019 at 07:56 pm

Leave a Comment