How to collect a HAR file without sanitizing in Google Chrome or Microsoft Edge


Overview

For issues related to network communication or request interception, a HAR file is crucial. It captures detailed HTTP traffic directly from the browser and does not require any additional software.

In some cases, you might need to export a HAR file without sanitizing it, meaning that the file will include sensitive data such as cookies, headers, tokens, and request bodies, which are often required in the course of investigation and debugging.

How to export a HAR file with sensitive data

To get a HAR file with sensitive data in Google Chrome or Microsoft Edge, enable a specific DevTools setting and then export the log file from the Network tab.

Step 1: Enable the setting "Allow to generate HAR (with sensitive data)"

  1. Open DevTools by pressing F12 or Ctrl + Shift + I.
  2. Go to the Network tab.
  3. Click the Settings icon in the top-right corner of the DevTools panel. (Those are the DevTools settings, not the browser settings.)
  4. In DevTools Settings, click Preferences.
  5. In the Network section, add the check mark Allow to generate HAR (with sensitive data):

    Note:
    Once enabled, this option is saved and used for all future HAR export operations.

Step 2: Export the HAR file with sensitive data

  1. Close the DevTools Settings panel.
  2. On the Network tab:
    • Add the check mark Preserve log.
    • Add the check mark Disable cache (recommended when reproducing issues).
  3. Reproduce the issue or carry out the tasks you want to record.
  4. Click the Export HAR button and save the HAR file with sensitive data:

Important: Taking into account that such HAR files might contain sensitive information, you must not upload it to public tools or forums. Make sure that you use secure file-transfer methods.