Skip to content

fix: replace httpx with curl_cffi to bypass Cloudflare TLS fingerprint detection - #26

Open
nhcnvk wants to merge 1 commit into
jackwener:mainfrom
nhcnvk:fix/curl-cffi-cloudflare
Open

nhcnvk wants to merge 1 commit into
jackwener:mainfrom
nhcnvk:fix/curl-cffi-cloudflare

Conversation

@nhcnvk

@nhcnvk nhcnvk commented Oct 23, 2026

Copy link
Copy Markdown

Problem

Cloudflare blocks rdt-cli requests from this host (67.180.202.42, Comcast residential IP) with 403 responses. The root cause is TLS fingerprint (JA3/JA4) detection: httpx sends a non-browser TLS fingerprint that Cloudflare recognizes as a bot and blocks.

The browser works fine via xrdp because Chrome's TLS fingerprint is whitelisted. Headless Chrome also fails because Cloudflare's challenge ("Prove your humanity") requires human interaction.

Fix

Replace httpx with curl_cffi (Python library providing curl with browser impersonation) using impersonate="chrome133a" — this sends a Chrome 133 TLS fingerprint that Cloudflare accepts.

Changes

  • rdt_cli/transports.py: Replace httpx.Client with curl_cffi.requests.Session(impersonate="chrome133a")

    • Updated close() call, client property return type
    • Updated _merge_response_cookies() to handle None cookies safely
    • Updated exception types (Timeout + RequestException)
    • Use allow_redirects instead of follow_redirects
  • pyproject.toml: Replace httpx>=0.27 with curl_cffi>=0.7

Verification

Tested on kavin-dc (67.180.202.42):

  • rdt whoami → returns user profile with read+write capabilities
  • rdt search "test" --limit 3 → returns valid Reddit search results

Dependencies

curl_cffi 0.16.3 is already in the rdt-cli venv. The chrome133a fingerprint is available in curl_cffi ≥ 0.7.

…t detection

Cloudflare blocks requests from httpx because its TLS fingerprint (JA3/JA4)
doesn't match any browser. Replace httpx.Client with curl_cffi Session
using impersonate='chrome133a' so requests carry a Chrome 133 TLS fingerprint
that Cloudflare accepts.

- Replace httpx with curl_cffi in transports.py
- Update pyproject.toml: httpx -> curl_cffi
- Fix exception types (Timeout -> Timeout, add RequestException)
- Fix cookie merge for None session.cookies
- Use allow_redirects instead of follow_redirects (curl_cffi param name)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant