Skip to main content
open sourcereverse engineeringhttp protocol8 min readBy Catmouse Engineering

Debugging HTTP and HAR Captures on macOS with HarFiddle

Last reviewed
Short answer

An HTTP Archive (HAR) is a JSON log of a browser session's network requests, headers, and responses. When a request works in Chrome but fails in a script, use HarFiddle on macOS to record a cold-start capture and replay the HAR locally at http://localhost:8888. Below: why captures fail, how to replay them, and what HAR omits.

Who this is for

Engineers and QA developers on macOS who debug HTTP clients on systems they own or are authorized to test, and need a repeatable workflow for turning browser captures into clean request sequences.

On this page
  1. Why do browser HAR exports fail in plain HTTP clients?
  2. How do you record a clean cold-start capture on macOS?
  3. How do you replay a HAR file as a local mock server?
  4. How do AutoResponder rules test client resilience?
  5. What does a HAR file omit about TLS and HTTP/2?
  6. Key takeaways
  7. Conclusion and scope
  8. Evidence and sources
  9. Frequently asked questions

Why do browser HAR exports fail in plain HTTP clients?

A copied browser request usually fails in a standalone script because it omits earlier cookies, redirect hops, or one-time tokens.

An HTTP Archive (HAR) is a JSON-formatted log of a web browser's transactions with a server. When an engineer exports a request from DevTools and runs it in Python, Node.js, or Go, the server frequently answers with 400 Bad Request, 403 Forbidden, or 429 Too Many Requests (defined in RFC 9110 and RFC 6585). Check five common causes before blaming TLS fingerprinting:

  1. Warm-profile state leakage: Opening DevTools on an active tab reuses existing cookies and localStorage tokens. A capture started mid-session misses the initial handshake.
  2. Hard-coded one-time tokens: Challenge headers such as Kasada's x-kpsdk-ct and single-use x-kpsdk-cd, or hCaptcha's h-captcha-response, cannot be replayed from a static paste.
  3. Corrupted script or payload bytes: On Kasada endpoints, the fetched ips.js script must reach POST /Solver/solve as unmodified UTF-8 text, and the base64 payload must be decoded to raw bytes before posting to /tl.
  4. Header family mismatches: Sending desktop Chromium sec-ch-ua Client Hints alongside a mobile Safari or iOS User-Agent creates an immediate contradiction.
  5. Dropped redirect cookies: Authentication flows often set cookies on 302 or 307 redirect hops that default HTTP clients fail to persist.

How do you verify capture mistakes in HarFiddle?

Compare the failing script request against the recorded browser session in the HarFiddle Inspector.

Table 1. Common capture mistakes and how to verify them
SymptomTypical capture mistakeHow to verify in HarFiddle
Immediate 400 or 422 on solver callTruncated or re-encoded ips.js body, or stale x-kpsdk-v version stringInspect the raw response bytes of the script request in the HarFiddle Inspector
200 on /tl with no x-kpsdk-r tokenStale version pin, mismatched Timezone/TimezoneOffset vs exit IP, or dirty egress IPCompare the live served x-kpsdk-v query parameter against your script's request
403 on protected POST after passing challengeReusing a single-use x-kpsdk-cd or h-captcha-response token across two callsFilter the session list by header to confirm each POST carries a freshly generated token
Missing session cookie on step 3Capture started in a warm tab after the cookie was already setLaunch a clean profile via the Browse button and record from the first navigation

How do you record a clean cold-start capture on macOS?

Click the Browse button in HarFiddle to launch an isolated Chrome profile with an empty cookie jar routed through 127.0.0.1:8888.

HarFiddle is a free, MIT-licensed macOS debugging proxy sponsored by Catmouse (and independent of Progress Software's Fiddler). As covered in our HarFiddle architecture and installation guide, the app runs a local proxy on 127.0.0.1:8888 and a UI on 127.0.0.1:8899.

Step-by-step cold-start recording

Follow these four steps to capture every bootstrap request without modifying your macOS system keychain:

  1. Open HarFiddle on macOS and click Browse in the toolbar.
  2. HarFiddle launches Google Chrome with a dedicated user profile pre-configured to route traffic through 127.0.0.1:8888 and trust the local HarFiddle certificate for that browser only.
  3. Navigate to the target URL you are authorized to test. Because the profile starts cold, every initial 429 challenge, Set-Cookie header, and redirect hop is recorded in order.
  4. Click Save to export the session list as a standard .har file.

How do you replay a HAR file as a local mock server?

Drag a .har file onto the HarFiddle window, choose AutoResponder, and send requests to http://localhost:8888.

Debugging parser logic or cookie jars directly against a live endpoint wastes proxy bandwidth and risks rate limits. Replaying the HAR locally lets you verify your client offline first.

Step 1: Export a full HAR capture or record traffic in HarFiddle on macOS (127.0.0.1:8888). Step 2: Load the HAR into the HarFiddle AutoResponder so each recorded request becomes a deterministic local rule. Step 3: Point your HTTP client or script at localhost:8888 to verify header casing, cookie jars, redirects, and ordered polling responses offline before testing live endpoints.
Figure 1. Turning a recorded HAR capture into a deterministic local mock server with HarFiddle on macOS. Diagram by Catmouse Engineering.

Direct mock mode versus proxy pass-through mode

Per the HarFiddle README, each entry in the HAR file becomes a rule on http://localhost:8888:

  • Direct mock mode: Send requests directly to http://localhost:8888/path?query and HarFiddle matches by path and query string.
  • Proxy pass-through mode: Set HTTP_PROXY=http://127.0.0.1:8888 and HTTPS_PROXY=http://127.0.0.1:8888 (plus NODE_EXTRA_CA_CERTS=~/.harfiddle/harfiddle-ca.pem or REQUESTS_CA_BUNDLE=~/.harfiddle/harfiddle-ca.pem) so your client uses the target URLs while HarFiddle intercepts matching rules locally.
  • Sequential replay: When a flow hits the same URL multiple times—such as a challenge endpoint returning 429 before a solve and 200 afterward—HarFiddle returns the recorded responses in chronological order by default.

How do AutoResponder rules test client resilience?

AutoResponder rules let you inject status codes, delays, socket drops, and redirects to verify how your client handles failures offline.

In HarFiddle's AutoResponder, rules are evaluated top-to-bottom (using EXACT:, REGEX:, substring, or * wildcards) and support built-in actions documented in the README:

# Example CLI test against HarFiddle local proxy on 127.0.0.1:8888
curl -i -x http://127.0.0.1:8888 -k https://api.example.com/v1/checkout
*404, *500 (or any status code)
Immediately returns that HTTP status with an empty body so you can verify that your client aborts on 400 errors and backs off on 500 or 503 responses.
*delay:2000
Pauses for two seconds before forwarding or answering, allowing you to test client timeout handling (such as the 60-second timeout on POST /Solver/solve or the 95-second timeout on POST https://api.hcap.catmouse.ai/solve).
*drop and *reset
Closes or resets the TCP socket mid-flight to verify that your connection pool recovers from dropped residential proxy exits.
*redir:https://...
Returns an HTTP 307 Temporary Redirect (RFC 9110 section 15.4.8) to verify whether your client preserves method, body, and cookies across redirects.

What does a HAR file omit about TLS and HTTP/2?

A HAR file records HTTP headers and bodies, but it omits TLS ClientHello cipher suites, HTTP/2 frame settings, and exit-IP geography.

While browser DevTools and HAR viewers are convenient for inspecting JSON payloads, they can give a false sense of security when a target also checks transport-layer signals. Conversely, jumping straight to TLS spoofing without checking HAR cookie and header continuity wastes time when a simple missing cookie is to blame. Once your sequence passes against a HAR replay in HarFiddle, verify three transport details:

  • TLS and HTTP/2 client profile: Standard language HTTP libraries emit distinctive TLS ClientHello and HTTP/2 settings frames. Ensure your HTTP client's transport profile aligns with the User-Agent and engine profile you send.
  • Exit-IP and timezone coherence: On the Catmouse Kasada API (/reference.html), Timezone and TimezoneOffset (or tz and tzOffset) are mandatory and must match the geographic location of your egress proxy IP. A mismatch causes the target to decline the submission downstream (EMPTY_R).
  • Live script version: Never hard-code the x-kpsdk-v version from an old HAR file. Parse the current x-kpsdk-v dynamically from the live challenge response on each run.

Key takeaways

  • Cold-start capture: Use HarFiddle's Browse button on macOS to capture from an empty Chrome profile so no initial cookies or challenge requests are missed.
  • Offline HAR replay: Drop a .har file onto HarFiddle's AutoResponder to replay responses on 127.0.0.1:8888 in recorded chronological order.
  • Byte integrity: Pass challenge script bodies (such as ips.js) as raw UTF-8 text and decode base64 payloads to raw bytes before submission.
  • Fault injection: Test *404, *500, *delay:2000, and *drop rules locally before deploying retry logic to production.
  • Transport alignment: Pair clean HTTP state with coherent TLS, HTTP/2, and exit-IP timezone settings.

Conclusion and scope

Most script failures that look like anti-bot blocks are actually state continuity bugs caused by warm-browser exports, mutated bytes, or dropped redirect cookies. Recording a cold-start session in HarFiddle and replaying the HAR locally on port 8888 separates HTTP state bugs from transport-layer checks before you touch a live target.

Scope and authorized use. This guide describes HTTP capture hygiene and local HAR replay using HarFiddle as documented in the project README on 2026-10-10, with no performance benchmarks. Keep ~/.harfiddle/harfiddle-ca-key.pem private, remove the root certificate from Keychain Access when finished, and capture or replay traffic only on systems you own or have explicit written permission to test.

Evidence and sources

The statements in this guide rest on the following primary sources:

  • HarFiddle GitHub repository and README. Supports: macOS 12+ support, MIT license, Catmouse sponsorship, independence from Progress Software/Fiddler, local ports 8888 (proxy/mock server) and 8899 (UI), the Browse button launching an isolated Chrome profile, chronological AutoResponder replay for repeated URLs, rule prefixes (EXACT:, REGEX:), and actions (*404, *500, *delay:2000, *drop, *reset, *redir:). Read 2026-10-09.
  • Catmouse OpenAPI 3.1 specification (/openapi.json) and API reference (/reference.html). Supports: the required raw UTF-8 ips.js script handling, dynamic x-kpsdk-v version requirement, mandatory Timezone/TimezoneOffset geo coherence, single-use x-kpsdk-cd proof-of-work tokens, and downstream EMPTY_R refusal behaviour. Reviewed 2026-10-10.
  • RFC 9110 (HTTP Semantics) and RFC 6585. Supports: standard definitions of HTTP 307 Temporary Redirect (section 15.4.8), 403 Forbidden (section 15.5.4), 502 Bad Gateway (section 15.6.3), and 429 Too Many Requests.
  • HTTP Archive (HAR) v1.2 draft specification. Supports: the scope of HAR files as JSON archives of HTTP-layer transactions rather than TLS handshake captures.

Methodology and limits. Documented: HarFiddle features from its README, Catmouse API requirements from /openapi.json and /reference.html, and HTTP status semantics from the RFCs above. Reviewed 2026-10-10.

Frequently asked questions

Why does a request copied from browser DevTools as cURL fail in a script?

Copy as cURL exports only one isolated request. It omits earlier redirect hops, dynamic CSRF or challenge tokens fetched by previous calls, Set-Cookie rotations, and the browser profile state that established the session.

How do you record a clean HAR capture without stale browser cookies?

Start from a fresh browser profile before opening the target page. In HarFiddle on macOS, clicking the Browse button opens Chrome with an isolated profile routed through 127.0.0.1:8888 so every initial bootstrap request, redirect, and cookie is recorded from a cold start.

How does HarFiddle replay polling or multi-step endpoints from a HAR file?

When you drop a HAR file onto HarFiddle and select AutoResponder, repeated URLs return their recorded responses in chronological order by default. You can also configure Matching options to cycle through responses or always return the first match.

Why must challenge script bodies be kept as raw UTF-8 bytes?

Anti-bot scripts such as Kasada ips.js are sensitive to byte-level mutations. Re-encoding, pretty-printing, or stripping characters from a captured script body changes its contents and causes parser or integrity refusals (400 or 422).

Does a HAR file capture TLS handshake fingerprints or proxy geography?

No. The HTTP Archive (HAR) format records HTTP-layer headers, bodies, and timings, not TLS ClientHello cipher suites, HTTP/2 frame settings, or exit-IP timezone alignment. Those transport properties must be verified separately in your HTTP client.