How to record a HAR file
How to save a HAR in each browser, how to keep requests across a reload, and what to check in the file before you send it to support.
What the file is and why you are asked for it
A HAR records every request a page made, with headers, response bodies and phase timings: which request failed, what the server answered, how long it took. Every major browser saves one. How to read it: the HAR viewer page.
Chrome, Edge and other Chromium browsers
Chrome, Edge, Brave, Opera and Yandex Browser share the Chromium developer tools.
- Open the developer tools:
F12orCtrl+Shift+I, on macOSCmd+Option+I, or three dots →More tools→Developer tools. - Switch to the
Networktab. - Tick
Preserve log, so the log survives reloads and navigation. - Press the clear icon (a crossed-out circle).
- Reproduce the problem.
- Press the download arrow in the tab's toolbar (
Export HAR (sanitized)…) and save the file.
Since version 130 Chrome leaves the Cookie, Set-Cookie and Authorization
headers out. They are rarely needed. For the full file, turn on
Allow to generate HAR with sensitive data in the developer tools settings
(Settings → Preferences → Network), then long-press the export button and
pick Export HAR (with sensitive data)….
Firefox
- Open the developer tools:
F12orCtrl+Shift+I, on macOSCmd+Option+I. - Switch to the
Networktab. - In the gear menu at the right of the toolbar, turn on
Persist Logs. - Reproduce the problem.
- In the same menu, choose
Save All as HAR.
Firefox keeps cookies and authorization headers in the file.
Safari
- Once:
Safari→Settings→Advanced→Show features for web developers. Develop→Show Web Inspector(Cmd+Option+I), tabNetwork.- Reproduce the problem.
- Press the export icon in the tab's toolbar and save the
.harfile.
Safari does not filter the file either.
If the problem is on a phone
Mobile browsers do not save a HAR. Record it from a computer:
- Android and Chrome. Turn on USB debugging in the developer options,
connect the phone by cable, open
chrome://inspecton the computer and pressinspectunder the page. Then as in the Chrome section. - iPhone and Safari. On the phone: Settings → Apps → Safari → Advanced →
Web Inspector (before iOS 18: Settings → Safari → Advanced). Connect it to a
Mac, then in Safari on the Mac:
Develop→ the phone's name → the page. Then as in the Safari section.
An app's traffic is recorded by a proxy, not a browser: see traffic from a phone.
What to check before you send it
Open the file in the viewer and search for
Authorization, Cookie, token, password. If such values are there and
need not be shared, record again in Chrome without sensitive data. Chrome drops
only those three headers: tokens in URLs and bodies stay. After sending, sign
out of the site: that usually ends the session the file holds.
A file of hundreds of megabytes will not go through email. Clear the log right before the error. If it is still large, zip it.
See it on your own traffic
A browser records only its own tabs. A debugging proxy records any program
that goes through it: a browser, a desktop app, a phone. Solpuga saves a
session as HAR 1.2 from Tools → Export Session as HAR…
(Cmd/Ctrl + Shift + E) or the download button in the title bar. Unfinished
requests are left out and binary request bodies are not saved. Details:
Capture & Inspect Traffic.
Tool for this page
HAR viewerOpen a HAR file and read the requests, headers, bodies and timings.Related
- SSE and the six-connection limit: the seventh tab never loadsAn SSE stream holds an HTTP/1.1 connection for as long as the tab is open, and a browser opens at most six of them per origin. The seventh tab just waits.
- The stream dies after 60 seconds: proxy_read_timeoutA stream that dies on the same second is a timeout. Default values in nginx, ALB, Cloudflare, Heroku and Envoy, and why a heartbeat is safer.