Proxy, User-Agent and Cookie Consistency in API Tests
Reuse the same egress IP and returned useragent when testing a cookie-based browser session. Diagnose mismatches before creating another task.
For authorized QA automation and browser integration. Use only on websites and workflows you have permission to test.
A cookie belongs to a browser session context
For authorized testing of cookie-based challenges such as DataDome, Akamai and PerimeterX, the response can depend on the egress IP and browser context. Reuse the proxy used for task creation and the returned useragent when consuming the result. A completed task does not guarantee that a cookie will work under a different context.
Before creating a task
For DataDome specifically, a completed task only returns a usable cookie when your follow-up request comes from the same egress IP and carries the returned useragent; the DataDome solver API lists the fields that bind that context. Confirm which fields your type reference requires. HTTP proxies use proxyAddress, string proxyPort, and proxyType:"http"; supply optional proxy credentials only on the server. Keep the full challenge URL intact and do not substitute a challenge from a different test session.
Reuse checklist
- Retain the selected proxy's egress IP for result consumption. A rotating gateway with the same hostname can still change IP.
- Use the returned useragent and maintain the application's other required browser state.
- Apply only the cookies relevant to the authorized application's domain and path, following the result format for that type.
- Check expiry and whether the challenge context has changed before another test.
Diagnose a rejected cookie
Compare task creation and result-consumption IPs locally. Check the actual user agent used by the HTTP client or test browser; setting a header in one request does not reconfigure an existing browser context. Inspect the application's validation response and cookie domain/path. Avoid logging proxy credentials or session cookies.
Do not immediately solve again: first correct the mismatch, then decide whether the challenge requires a fresh task. Field and solution formats differ across DataDome, Akamai and PerimeterX; there is no universal cookie parser.
Does this apply to OCR?
OCR takes image bytes and has no browser session to reuse. Do not add proxy requirements to unrelated types. See error handling for request failures rather than session-context mismatches.
Related documentation
Last updated: