---
slug: cloudflare-1015-520-scraping-errors
category: "Data & Scraping"
title: "Fixing Cloudflare Error 1015 & 520 in Web Scrapers & AI Agents"
url: https://duang.ai/guides/cloudflare-1015-520-scraping-errors
---

# Fixing Cloudflare Error 1015 & 520 in Web Scrapers & AI Agents

Understand why DIY Python and Playwright scrapers hit Cloudflare Error 1015 (rate limited) and HTTP 520 (origin handshake failure), how to handle retries cleanly, and when managed per-call extraction wins.

> **Key takeaway:** Cloudflare 1015 signals aggressive per-IP rate limiting while 520 indicates an unexpected origin response—managed web reading APIs absorb anti-bot friction and bill $0 on upstream failures.

## What Error 1015 and HTTP 520 actually mean

Error 1015 is Cloudflare's HTTP 429 rate-limit response triggered when a single IP or TLS fingerprint sends too many requests in a short window. HTTP 520 means the origin server returned an empty, invalid, or reset response to Cloudflare's edge.

- Error 1015 (429): triggered by datacenter IPs, burst concurrency, or missing backoff headers.
- Error 520: triggered by malformed headers, oversized cookies, origin crashes, or abrupt TCP resets.
- Blind immediate retries amplify 1015 bans and burn proxy bandwidth without returning usable content.

## Engineering fixes vs managed web extraction

Respect Retry-After headers, cap per-domain concurrency, and use idempotent requests. For AI agents that only need clean article or product content on demand, routing web.page.read through specialized extraction suppliers avoids maintaining browser fingerprints and proxy pools.

### Extract clean Markdown via managed web.page.read

```bash
npx @fastagent-sh/duang call web.page.read --input '{"url":"https://example.com/pricing"}'
```

## Zero wasted spend on failed fetches

With direct scraping subscriptions you often burn credit multipliers even on blocked or retried attempts. On Duang, upstream supplier failures cost $0, and every successful call returns an exact micro-USD receipt.

## Live Capabilities Mentioned

| Capability | Price | Page |
| :--- | :--- | :--- |
| `web.page.read` | from $0.0015/call | https://duang.ai/data/web/page-read |
| `web.site.urls` | from $0.0015/call | https://duang.ai/data/web/site-urls |
| `web.search` | from $0.00075/call | https://duang.ai/data/web/search |

## Frequently Asked Questions

### Why does my script get Cloudflare Error 1015 from a cloud VM?

Cloud provider IP ranges (AWS, GCP, DigitalOcean) are heavily shared and aggressively rate-limited by WAF rules when requests arrive without backoff or browser-grade TLS profiles.

### Does Duang charge when an upstream site blocks a scrape?

No. Upstream supplier failures and Duang platform errors are billed $0 on managed calls.

### How does Error 520 differ from Error 1015 when debugging?

Error 1015 is an edge rate limit (HTTP 429) caused by too many requests from one IP or fingerprint, whereas HTTP 520 means the origin web server returned an invalid or empty response behind Cloudflare.

## Try It on Duang

- Start with $1 free credit (no card required): https://duang.ai/sign-up
- Remote MCP endpoint: `https://api.duang.ai/mcp`
- Agent Skill setup: `set up https://duang.ai/SKILL.md`
