问题原文
原帖链接 · dargmuesli · CC BY-SA 3.0
Issue
Many CSP validators like cspvalidator.org tell me that:
A draft of the next version of CSP deprecates report-uri in favour of a new report-to directive.
I found more information about this on wicg.github.io, but I didn't find an example / a solution.
Question
How do I properly implement the Report-To HTTP header in Apache 2?
This doesn't throw an error but also does not execute the linked script in Firefox 49 and Chrome 53:
Header set Report-To "{'url': 'https://website.com/csp-report.php', 'group': 'csp-endpoint', 'max-age': 10886400}"
With the Content-Security-Policy header implemented like this:
Header set Content-Security-Policy "default-src 'none'; report-to csp-endpoint"
已采纳解答
原帖链接 · Braiam · CC BY-SA 4.0
There are examples in the draft of the Reporting-Endpoints directive:
Reporting-Endpoints = endpoint-1="https://example.com/reports"
Your rule is correctly created, as in it returns a valid JSON object, but since the Reporting API is still a draft, most UA haven't got around implementing it. You could simply have both, report-uri and Reporting-Endpoints header meanwhile if you want to.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
