Set up Network Error Logging
Two response headers make Chromium browsers report every failed request to your site to fastmon.
Two response headers on your origin make the browser report every failed request to fastmon, including pages that never ran the tracker. Only Chromium browsers send reports. What the reports show is on Network Error Logging.
Set it up
- Enter the application's
collector_hashin the panel below, or open this page with?collector_hash=. Every snippet on the page then uses it. - Send the two headers on every HTTPS response of each host.
- Make sure every host that sends them is a site of that application, or a subdomain of one.
- Verify that a report arrives.
Your snippet
Opened from the app, these are filled in with your application's real values. Otherwise, paste them here and every snippet on this page updates.
Find both hashes in the app under Applications → ··· → IDs & hashes.
A report whose host is no site of the application is dropped, and a report never creates a site. www.shop.example counts for shop.example, notshop.example does not.
The headers
Report-To: {"group":"fastmon","max_age":86400,"endpoints":[{"url":"https://fastmon.site/c/n/{collector_hash}"}]}NEL: {"report_to":"fastmon","max_age":86400,"success_fraction":0,"failure_fraction":1}An application with a custom collector endpoint uses its own host instead of fastmon.site.
| Field | Header | Value | What it does |
|---|---|---|---|
group / report_to | both | fastmon | Links the two headers. Any name works if both use the same one. |
max_age | Report-To | 86400 | How long the browser keeps the endpoint, in seconds. Keep it at least as long as the NEL one. |
url | Report-To | https://fastmon.site/c/n/{collector_hash} | Where reports go. |
max_age | NEL | 86400 | How long the policy stays in the browser. Every response renews it. |
success_fraction | NEL | 0 | Share of successful requests to report. fastmon drops those reports. |
failure_fraction | NEL | 1 | Share of failed requests to report. Below 1, each row counts 1 / failure_fraction, and rare errors can vanish. |
Where to set them:
- On every response, error pages included. On a site behind several addresses, an error page without the headers is lost.
- At the outermost server you control. The ingress or load balancer answers its own 502, which the application never sees.
- Over HTTPS only. The browser ignores a policy from a plain HTTP response.
- On each host.
www.shop.exampleandshop.exampleare two policies.
Examples
server { listen 443 ssl; server_name shop.example; add_header Report-To '{"group":"fastmon","max_age":86400,"endpoints":[{"url":"https://fastmon.site/c/n/{collector_hash}"}]}' always; add_header NEL '{"report_to":"fastmon","max_age":86400,"success_fraction":0,"failure_fraction":1}' always;}always adds the headers to error responses. A location block with its own add_header inherits none from server, so repeat both lines there.
include_subdomains
"include_subdomains":true in the NEL header extends the policy to every subdomain of the host. For those subdomains the browser reports DNS failures only. fastmon keeps such a report when the subdomain is a site of the application, or a subdomain of the only site. A subdomain that serves its own responses is better covered by its own headers.
Verify
- The headers arrive. In the browser's network tab, check any response of the host for
Report-ToandNEL. - A report goes out. Load a page in Chrome, then open a path that does not exist. The 404 has to carry both headers too. Chrome uploads an
http.errorreport after about a minute. - The endpoint answers. Test it without a browser, with a registered site in place of
shop.example:
curl -i https://fastmon.site/c/n/{collector_hash} \-H 'Content-Type: application/reports+json' \--data '[{"age":0,"type":"network-error","url":"https://shop.example/missing","body":{"type":"http.error","phase":"application","status_code":404,"elapsed_time":12,"method":"GET","protocol":"http/1.1","referrer":"","sampling_fraction":1}}]'The endpoint answers 204 whether it kept the report or dropped it. The Sites and hosts card on the dashboard shows each site's last report.
Traps
- Cloudflare replaces your headers when its own Network Error Logging setting is on. Turn it off for the zone.
- Shopify storefronts allow no custom response headers, so a Shopify shop cannot send a policy.
Report-Tois required. Chromium's NEL does not readReporting-Endpoints.- Each application has its own hash. A report for a site of another application drops, even in the same organization.
- A hash rotation stops the reports silently. Put the new
collector_hashintoReport-To. - A first-party proxy has to forward
/c/n/and the browser'sOPTIONSpreflight. Alocation /c/block covers both. - Removing the headers does not remove the policy. Browsers keep reporting for up to
max_ageseconds. To stop sooner, sendNELwith"max_age":0for a day first.