Browser Crash Logging Configuration
This feature is currently only compatible with Chrome/Edge 96+.
In order to use the Crash Logging feature, your server must send a Reporting-Endpoints
header in the initial page response whose value is a comma-separated list of endpoint names and double-quoted URIs.
Reporting-Endpoints: default="https://app.logrocket.com/reports/{orgName}/{appName}", secondary-endpoint="..."
Including LogRocket's reporting endpoint postfixed with your application slug will inform your users' browsers to send crash reports to LogRocket, where they will be correlated with the associated LogRocket sessions.
This header can either be configured server- or CDN-side.
Configuring reporting endpoints with a Cloudflare Worker
The snippet below demonstrates tagging responses with the Reporting-Endpoints
header via CloudFlare Worker.
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* Add Reporting-Endpoints header
* @param {Request} request
*/
async function handleRequest(request) {
const response = await fetch(request);
const reportingEndpoints = response.headers.get('Reporting-Endpoints');
if (!reportingEndpoints) {
const newHeaders = new Headers(response.headers);
const reportToHeader = 'default="https://app.logrocket.com/reports/orgName/appName"';
}
newHeaders.set('Reporting-Endpoints', reportToHeader);
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
});
}
return response;
}
Updated 16 days ago