What is a HAR file and How Is It Generated?

HAR files are great for providing additional information about HTTP requests.
Sometimes, when I’m troubleshooting issues on sites, we ask users to send us a HAR file. These are really useful for debugging difficult issues.
This article will help you creating HAR files and give you a little more information about it.
What is a HAR file?
A HAR file records HTTP requests in a JSON format. Some of the recorded information for each HTTP request are:
- the URL
- headers
- cookies
- request data
- response
- timings
HAR files can contain sensitive data, so make sure you store these files securely.
How to generate a HAR file
One of the easiest ways to generate the HAR file is using Google Chrome. You can follow these steps:
- Open the page you want to inspect on Google Chrome.
- Select the Chrome menu at the top-right of the browser window.
- Select More Tools > Developer Tools.
- On the Developer Tools window, click on the Network tab.
- Check the box “Preserve Log” and make sure it is recording the log (red ball on the left).
- Refresh the page and navigate, or interact with the page until reproduced the problem you have been experiencing.
- On the Network tab, click the right button on the list of requests and select “Save as HAR with content”.
- Save the HAR file to a convenient place.
How to load or analyze the generated file
The HAR file is a text file, so you are able to load it on any Source Code or Text Editor. But in order to get a better visualization of the data, you can use analyzers like the one provided by Google: HAR Analyzer from the G Suit Toolbox