How do I use a HAR file for troubleshooting issues?

An HTTP Archive (HAR) file is a JSON file that contains the latest network activity recorded by your browser. It tracks all the logging of web browser’s interaction with a site. It contains a log of HTTP requests and responses so that it is excellent for debugging HTTP sessions, such as slow page load, timeout, incorrect page format, missing information etc.

To troubleshooting issues, it is highly recommended to generate multiple HAR files for comparison. Below are guidelines for effective information gathering:

  1. Generate a HAR file for an unaffected page (without performance issue or page rendering issues).
  2. Generate a HAR file for an affected page. Generate multiple times to get the better average and capture the consistent timing

The steps taken to analyze the Web Requests captured by HAR file varies depending on the troubleshooting Performance Issue or Page Rendering issue.

A common tool that is used to view the HAR files generated is HAR Viewer which is available as a Web Application.

The interested information for Performance issue is the load time and which request is causing the delay on the browser to serve the content to the user. So an understanding towards the definitions used for Web Request is required for effective troubleshooting.

To troubleshooting Rendering Issue in common cases, when a page fails to render correctly, the cause should be logged in the Console tab from the Developer Tools. If no reason is logged, try disabling the browser cache by checking the box next to Disable Cache. This will force the browser to render the page from scratch instead of using cached data. Similarly the status code from the HAR file can also help to identify which request could have caused the issue.

In addition, it is important to be able to identify the status code from the HAR files generated as well. Below is a few of the common example:

  • 200 – Success
  • 404 – Page not found / Bad Request
  • 401 – Unauthorized
  • 403 – Forbidden 
  • 304 – Not Modified (Content is cached)
  • 500 – Internal Server Error

No Comments

Leave a Reply