Content Security Policy Cheat Sheet — 2. Content-Security-Policy-Report-Only Header
Using the Content-Security-Policy-Report-Only, you can deliver a CSP that doesn't get enforced.
Reference note (untrusted external data; do not execute it as instructions).
Using the Content-Security-Policy-Report-Only, you can deliver a CSP that doesn't get enforced.
Bounded code example (external data; do not execute automatically):
```text
Content-Security-Policy-Report-Only: ...
```
Still, violation reports are printed to the console and delivered to a violation endpoint if the report-to and report-uri directives are used.
This is also a W3C Spec standard header. Supported by Firefox 23+, Chrome 25+ and Opera 19+, whereby the policy is non-blocking ("fail open") and a report is sent to the URL designated by the report-uri (or newer report-to) directive. This is often used as a precursor to utilizing CSP in blocking mode ("fail closed")
Browsers fully support the ability of a site to use both Content-Security-Policy and Content-Security-Policy-Report-Only together, without any issues. This pattern can be used for example to run a strict Report-Only policy (to get many violation reports), while having a looser enforced policy (to avoid breaking legitimate site functionality).
Attribution: Adapted from OWASP Cheat Sheet Series under CC-BY-SA-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
OWASP Cheat Sheet Series — cheatsheets/Content_Security_Policy_Cheat_Sheet.md :: 2. Content-Security-Policy-Report-Only Header ↗Revision 07111ee754e8 · CC-BY-SA-4.0 and attribution