NEL Header

Table of Content

The Network Error Logging (NEL) header provides a powerful mechanism that allows web developers to capture and report about network errors. The purpose this serves is to help understand what types of network issues their users are experiencing. This could include DNS lookup failures, TLS negotiation failures, or even users dropping off of a network altogether. By understanding the network environment of a website's users, developers can work toward solutions that minimize these errors and increase the overall service availability.

Syntax

In its simplest form, the format of a NEL policy is as follows:

NEL: {"report_to": "endpoint-1", "max_age": 31536000} 

Directives

The NEL header allows a number of directives, among them are:

  • report_to: Used to specify the group (endpoint) to which the user agent should send the report.
  • max_age: This defines the duration, in seconds, for which the policy is regarded as valid.

Examples

Here is an example of how to use a NEL header:

NEL: {"report_to": "default", "max_age": 31536000, "include_subdomains": true}

In the example above, the user agent will send network error reports for this website and its subdomains to the "default" reporting endpoint.

Browser Compatibility

Browser Compatibility
Chrome Supported
Firefox Not Supported
Safari Not Supported
Opera Supported
Edge Not Supported

How to modify NEL header

ModHeader is a browser extension that allows you to manage and manipulate HTTP request headers. This can be handy for testing or debugging the NEL header.

Here's how you would use ModHeader to modify the NEL header:

  1. Install the ModHeader extension from the Chrome Web Store.
  2. Click on the ModHeader icon in the toolbar to open the extension.
  3. In the 'Response headers' section, click 'Add' and enter 'NEL' as the header name.
  4. In the value field, you would then enter a valid NEL policy, for instance - {"report_to": "default", "max_age": 31536000}.
  5. Now, ModHeader will automatically add or modify the NEL header for all websites you visit.

This ability to modify the NEL header is useful in development and testing. You can test how your site behaves under different network conditions or verify that your server handles network error reports correctly. You can also use it to temporarily disable NEL during debugging or when experimenting with different server configurations.