Linux-NGINX 能否添加P3P头,如何添加。

发布于 2016-12-11 20:42:05 字数 48 浏览 1599 评论 3

求实践性东东,提供demo 感谢。wiki 我也查了很多,就是不会设置阿。。。愚昧

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

偏爱自由 2017-11-03 04:52:52

可以
demo如下

server
{
listen 80;
server_name yourdomain;
root /data/app/www/oa.kunlun.com/htdocs;
userid on;
userid_name nginx;
userid_domain yourdomain;
userid_path /;
userid_expires 365d;
userid_p3p 'policyref="http://www.w3.org/2001/05/P3P/p3p.xml", CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"';
index index.php index.html index.htm;
location xxxx{
yourlocation
}
}

配置好后使用curl -I 可以看到结果

晚风撩人 2017-06-08 12:48:53

看了很多,确实只有ngx_http_userid_module模块提到了nginx设置p3p,安装一下应该是能达到目的 http://wiki.nginx.org/HttpUserIdModule

不过建议还是通过程序来添加更方便一些:

ASP直接在头部加了头部申明:
<%Response.AddHeader "P3P", "CP=CAO PSA OUR"%>

php直接设置header:
header('P3P: CP=CAO PSA OUR');

JSP:
response.setHeader("P3P","CP=CAO PSA OUR")

ASP.NET
通过在代码上加Response.AddHeader("P3P", "CP=CAO PSA OUR")或者在Window服务中将ASP.NET State Service 启动。

归属感 2017-04-02 06:11:43

查了一下资料,nginx0.8.20的升级文档说这之后的版本只要不设置都不会隐藏p3p和setcookie的header。

nginx 0.8.20的更新日志:http://linux.cn/thread/1000/1/1/

Bugfix: the "Set-Cookie" and "P3P" FastCGI response header lines were not hidden while caching if no "fastcgi_hide_header" directives were used with any parameters.

另附nginx关于p3p的介绍:
http://wiki.nginx.org/HttpUserIdModule

希望对你有帮助。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文