大网数据广告活动
Web 标准与前端开发

Reporting-Endpoints header

· 52CE 我爱测

The HTTP **`Reporting-Endpoints`** response header allows website administrators to specify one or more endpoints that can be sent reports generated by the Reporting API.

The HTTP Reporting-Endpoints response header allows website administrators to specify one or more endpoints that can be sent reports generated by the Reporting API.

The endpoints can be used, for example, as targets for sending crash reports, deprecation reports, Content Security Policy (CSP) violation reports, Cross-Origin-Opener-Policy reports, and so on.

[!NOTE] This header replaces Report-To for declaring endpoints, and should be used in preference.

<table class="properties"> <tbody> <tr> <th scope="row">Header type</th> <td>Response header</td> </tr> <tr> <th scope="row"> CORS-safelisted response header </th> <td>No</td> </tr> </tbody> </table>

Syntax

Reporting-Endpoints: <endpoint>
Reporting-Endpoints: <endpoint>, …, <endpointN>
  • <endpoint>
    • : A reporting endpoint in the format <endpoint-name>="<URL>". The endpoints must have valid URIs in quoted strings (e.g., my-endpoint="https://example.com/reports") and non-secure endpoints are ignored. A comma-separated list of endpoints may be provided.

Description

The Reporting-Endpoints header defines the mapping between an endpoint name and a URL.

This name can be used to identify the reporting endpoint for policy violations in some HTTP headers. For example, the Content-Security-Policy allows you to specify the reporting endpoint name in its report-to directive, while the endpoints key serves the same purpose for Integrity-Policy violations.

Default reporting endpoint

The default reporting endpoint is just a report with the name "default", as shown:

Reporting-Endpoints: default="https://example.com/reports"

This may be used as the reporting endpoint for cases where the HTTP header that triggers a report does not have mechanism for reporting the endpoint, such as the Permissions-Policy header. It may also be used as the endpoint for reports where there is no associated HTTP header at all, such as for deprecation reports.

Examples

Setting a CSP violation report endpoint

The following example shows how the Reporting-Endpoints response header is used in conjunction with the Content-Security-Policy header to indicate where CSP violation reports are sent:

Reporting-Endpoints: csp-endpoint="https://example.com/csp-reports"
Content-Security-Policy: default-src 'self'; report-to csp-endpoint

Specifying multiple reporting endpoints

It's possible to specify multiple endpoints that can be used for different types of violation reports.

Reporting-Endpoints: csp-endpoint="https://example.com/csp-reports",
                     permissions-endpoint="https://example.com/permissions-policy-reports"

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。