Web scraping - what is HTTP 520 status code?

Response status code 520 generally means the server failed to generate a valid response (Often related to Cloudflare). This could be caused by technical issues however in web scraping this can also mean insufficient request details or web scraper blocking.

To avoid status code 520 when web scraping ensure that sent requests contain all required headers like secret/CSRF tokens, Origin, Referer and other commonly required details. If it's a POST request make sure the sent body matches expected format.

Otherwise, it's possible the scraper is being identified and blocked. For that refer to our how to scrape without being blocked guide which covers all of the ways to prevent web scrapers from being identified.

Provided by Scrapfly

This knowledgebase is provided by Scrapfly — a web scraping API that allows you to scrape any website without getting blocked and implements a dozens of other web scraping conveniences. Check us out 👇