Looking for the Turnstile widget instead? See /docs/cloudflare — this page covers the WAF challenge flow (cf_clearance), not the Turnstile sitekey widget.
Resolving Cloudflare WAF Challenges
Cloudflare WAF intercepts requests with managed and interactive challenges, returning a challenge page until the visitor obtains a valid cf_clearance cookie. MeshPrivacy completes the challenge server-side and returns the cookie ready for use with your proxy and user agent.
Error Codes
| Code | Meaning | Resolution |
|---|---|---|
| 403 | Challenge not solved | Solve via API to obtain cf_clearance |
| 503 | Interactive challenge served | Submit task with the same proxy you'll use for follow-up requests |
Service Schema
| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Protected URL showing Cloudflare challenge |
proxy_config | string | Yes | Proxy in http://user:pass@ip:port format — must match downstream IP |
user_agent | string | No | Custom user agent string |
Service ID: cloudflare_waf · Status: Stable
Cookies & Headers
Returned Cookies
cf_clearance — Primary challenge clearance cookie (IP + UA bound)__cf_bm — Bot management session cookieBoth cookies are bound to the IP and user agent used during the solve. Reuse them only with the same proxy and UA.
Integration Example
cloudflare-waf.js
// Submit Cloudflare WAF task to MeshPrivacy
const response = await fetch('https://api.meshprivacy.com/v1/tasks/submit', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-Key': API_KEY },
body: JSON.stringify({
service: 'cloudflare_waf',
url: 'https://target-site.com/', // required
proxy_config: 'http://user:pass@ip:port', // required
user_agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)...'// optional
})
});
const { task_id } = await response.json();
const result = await fetch(`https://api.meshprivacy.com/v1/tasks/result/${task_id}`, {
headers: { 'X-API-Key': API_KEY }
});
const { cookies } = await result.json();
// Use cookies.cf_clearance in your downstream requestsFAQ
Turnstile is a sitekey-based widget you embed on a form. Cloudflare WAF is the network-edge challenge that gates a URL before any form. They are distinct services in MeshPrivacy:
turnstile vs cloudflare_waf.