# httpcloak

> A Go HTTP client whose TLS, HTTP/2 and HTTP/3 traffic matches a real browser byte for byte

- Category: Data & Labeling / Web Scraping & Crawling
- Language: Go
- Licence: MIT
- Repository: https://github.com/sardanioss/httpcloak
- Website: https://httpcloak.dev
- Canonical page: https://ai-tldr.dev/tools/httpcloak/

## In short

httpcloak is an open-source HTTP client written in Go that makes your requests look like they came from a real web browser, not just in the User-Agent header but in the low-level bytes of the connection itself. It sits in the Web Scraping & Crawling category of the Data & Labeling tools and is open-source, written in Go and licensed MIT.

## Overview

httpcloak is an open-source HTTP client written in Go that makes your requests look like they came from a real web browser, not just in the User-Agent header but in the low-level bytes of the connection itself. It speaks HTTP/1.1, HTTP/2 and HTTP/3, and the same API is exposed to Python, Node.js and .NET through a shared cgo library, with an Android (Kotlin) binding you build from source.

Why does that matter? Every time a client opens an HTTPS connection it sends a TLS handshake listing the ciphers, extensions and settings it supports. Different software sends a different mix, so the handshake works like a fingerprint: summaries such as JA3 and JA4 turn it into a short ID. HTTP/2 and QUIC (HTTP/3) connections leak similar fingerprints through their settings frames and transport parameters, and even the order of headers and the TCP packet parameters reveal what is really talking. Bot-detection services compare these signals with the browser you claim to be, and a scraper using a standard library HTTP client gets blocked even when its headers look perfect.

httpcloak ships presets for Chrome, Firefox and Safari across desktop and mobile platforms, so one preset name sets the TLS handshake, HTTP/2 and QUIC parameters, header set and order, and the TCP/IP profile together. That is useful for scrapers, data pipelines and AI agents that fetch public web pages, and for anyone testing how their own anti-bot setup reacts. You can also build a custom fingerprint from a JSON spec captured from a real browser.

## What it does

- TLS layer emulation: JA3/JA4 fingerprints, GREASE randomization, post-quantum X25519MLKEM768 and Encrypted Client Hello (ECH)
- Transport emulation: HTTP/2 SETTINGS, WINDOW_UPDATE and stream priorities, QUIC transport parameters, HTTP/3 GREASE frames and TCP/IP stack values (TTL, MSS, window)
- Header-layer coherence: Sec-Fetch-* and Client Hints headers, header ordering and cookie persistence
- Browser presets for Chrome, Firefox and Safari, plus custom presets loaded from JSON and rotated with PresetPool
- Proxy support including HTTP/3 over SOCKS5 UDP ASSOCIATE or MASQUE, runtime proxy switching and split TCP/UDP proxies
- Sessions you can save and reload for TLS session resumption, plus certificate pinning, request hooks and per-request timing

## Getting started

Install the package for your language, pick a browser preset such as chrome-latest, and make requests as you would with any HTTP client.

1. Install the package

   httpcloak is published to PyPI, npm, the Go module proxy and NuGet. The Android (Kotlin) binding is built from bindings/android in the repository.

```bash
pip install httpcloak        # Python
npm install httpcloak        # Node.js
go get github.com/sardanioss/httpcloak   # Go
dotnet add package HttpCloak # C#
```

2. Make a request from Python

   Pass a preset to get a full browser transport-layer fingerprint. The response tells you which protocol was negotiated.

```python
import httpcloak

# Simple request
r = httpcloak.get("https://example.com", preset="chrome-latest")
print(r.status_code, r.protocol)

# POST with JSON
r = httpcloak.post("https://httpbin.org/post",
    json={"key": "value"},
    preset="chrome-latest"
)
```

3. Use the Go client

   Create a client with a preset name, then call Get or Post with a context. Close the client when you are done.

```go
import (
    "context"
    "github.com/sardanioss/httpcloak/client"
)

// Simple request
c := client.NewClient("chrome-latest")
defer c.Close()

resp, _ := c.Get(ctx, "https://example.com", nil)
body, _ := resp.Text()
fmt.Println(resp.StatusCode, resp.Protocol)
```

4. Or use a Node.js session

   In Node.js, open a Session with a preset; cookies and connections persist across its requests.

```javascript
import httpcloak from "httpcloak";

const session = new httpcloak.Session({ preset: "chrome-latest" });
const r1 = await session.get("https://example.com");
console.log(r1.statusCode, r1.protocol);

session.close();
```

5. Check your fingerprint

   The README points to tls.peet.ws (JA3, JA4, Akamai), quic.browserleaks.com (QUIC) and cloudflare.com/cdn-cgi/trace (ECH status) for verifying what the server sees. Full guides on proxies, fingerprinting and bindings are at httpcloak.dev.

## When to use it

- Scrapers and AI agents that get blocked because a standard HTTP library's TLS or HTTP/2 fingerprint does not match the browser in its User-Agent
- Fetching pages over HTTP/3 through residential or MASQUE proxies while rotating proxies inside one session
- Reproducing a specific browser's network fingerprint from a JSON capture to test bot-detection rules
- Adding browser-grade transport fingerprints to Python, Node.js, .NET or Go code without running a headless browser
