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

CodeMeaningResolution
403Challenge not solvedSolve via API to obtain cf_clearance
503Interactive challenge servedSubmit task with the same proxy you'll use for follow-up requests

Service Schema

FieldTypeRequiredDescription
urlstringYesProtected URL showing Cloudflare challenge
proxy_configstringYesProxy in http://user:pass@ip:port format — must match downstream IP
user_agentstringNoCustom 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 cookie

Both 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 requests

FAQ

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.

Related Services