You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SecureHeaders supports both the legacy `report-uri` and the modern `report-to` directives for CSP violation reporting:
108
+
109
+
#### report-uri (Legacy)
110
+
The `report-uri` directive sends violations to a URL endpoint. It's widely supported but limited to POST requests with JSON payloads.
111
+
112
+
```ruby
113
+
config.csp = {
114
+
default_src:%w('self'),
115
+
report_uri:%w(https://example.com/csp-report)
116
+
}
117
+
```
118
+
119
+
#### report-to (Modern)
120
+
The `report-to` directive specifies a named reporting endpoint defined in the `Reporting-Endpoints` header. This enables more flexible reporting through the HTTP Reporting API standard.
121
+
122
+
```ruby
123
+
config.csp = {
124
+
default_src:%w('self'),
125
+
report_to:"csp-endpoint"
126
+
}
127
+
128
+
config.reporting_endpoints = {
129
+
"csp-endpoint": "https://example.com/reports"
130
+
}
131
+
```
132
+
133
+
**Recommendation:** Use both `report-uri` and `report-to` for maximum compatibility while transitioning to the modern approach.
134
+
94
135
### Deprecated Configuration Values
95
136
*`block_all_mixed_content` - this value is deprecated in favor of `upgrade_insecure_requests`. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/block-all-mixed-content for more information.
0 commit comments