nginx添加自定义header

nginx.conf,如下:

location / {
add_header X-UA-Compatible 'IE=Edge,chrome=1'; # 这里是自定义头
root www/htdocs;
index index.php index.html index.htm;
}

其中,X-UA-Compatible是名称,IE=Edge,chrome=1是值,可以随意自定义。在html的<head></head>标签中可以添加http请求:

<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">

添加完之后重启nginx和浏览器,然后打开添加了自定义head的页面查看效果。
原文地址:https://www.cnblogs.com/sumsung753/p/3821514.html