coreproxies.com

Home / Blog / How to avoid IP bans

How to Avoid IP Bans When Web Scraping

Most IP bans are caused by request volume and by patterns that no human visitor produces. Slow down, spread the load across addresses, keep each session consistent and react to the server's own warnings before they become a block.

8 min readWeb scraping

Why do sites block IP addresses?

Sites block an address when it sends more traffic than a person could, or traffic that does not look like a visitor. A website has limited capacity and a duty to its regular visitors. When one address sends far more requests than a person could, the operator has three reasonable explanations: a misconfigured bot, an attack, or a scraper that does not care about load. Blocking the address is the cheapest response to all three.

Four things usually trigger a block:

The first three are under your control regardless of which proxy you use. Proxies help with the load per address and with reputation; they do not make an aggressive crawler polite.

What are the warning signs before a ban?

Status codes 429, 403 and 503, challenge pages and rising response times. A ban rarely arrives without notice. Log these signals and treat each one as a reason to slow down:

SignalWhat it usually meansWhat to do
HTTP 429Rate limit reachedWait for the time in Retry-After, then continue more slowly
HTTP 403Request refused for this client or IPStop retrying on the same IP; check headers and the site's rules
HTTP 503 in burstsServer overloaded or throttlingBack off for minutes, not seconds
200 with a challenge pageThe site wants to confirm a human visitorCount it as a failure; lower the rate, review the session
Rising response timesSoft throttlingReduce concurrency before errors start
Empty or truncated resultsDegraded responses for suspected botsValidate content, not only status codes

How fast should a crawler send requests?

As slowly as the job allows, with a limit per domain and random pauses. Rate is the most common cause of bans and the easiest to fix.

What should you do on HTTP 429?

Wait, and wait longer each time it repeats. A 429 response is the site telling you the limit. Retrying at once from the same address converts a temporary limit into a ban.

The example below uses placeholders. Replace HOST, PORT, USERNAME and PASSWORD with the values from your dashboard. On Residential, a username without a session gets a new IP on every new connection.

import random
import time
import requests

PROXY = 'http://USERNAME:PASSWORD@HOST:PORT'
PROXIES = {'http': PROXY, 'https': PROXY}

def fetch(url, tries=4):
    for attempt in range(tries):
        r = requests.get(url, proxies=PROXIES, timeout=30)
        if r.ok:
            return r
        if r.status_code in (429, 503):
            retry_after = r.headers.get('Retry-After', '')
            wait = int(retry_after) if retry_after.isdigit() else 2 ** attempt
            time.sleep(wait + random.uniform(0, 1))
            continue
        r.raise_for_status()
    raise RuntimeError('gave up on ' + url)

Two details matter here. The wait doubles on each attempt (1, 2, 4, 8 seconds) unless the server names a time. And the function gives up after four tries: a URL that keeps failing goes to a retry queue for later, not into a tight loop.

When should you rotate IPs and when not?

Rotate for requests that stand alone, and keep one IP for requests that belong together. Rotation spreads requests across many addresses so that no single IP carries a noticeable share. On Residential and Unlimited Residential plans the username decides:

# Rotating: without a session, every new connection gets a new IP
HOST:PORT:USERNAME:PASSWORD

# Sticky session: keep one IP for 1 hour
HOST:PORT:USERNAME-session-482913-ttl-3600:PASSWORD

Use rotating sessions for independent requests: product pages, search result pages, anything where each fetch stands alone.

Use sticky sessions when requests belong together: a login followed by account pages, a cart, a multi-step form, or pagination that depends on a cookie. A logged-in session that changes IP on every request looks like a stolen cookie, and sites react to that. On Residential and Unlimited Residential the TTL is in seconds and sessions last up to 24 hours; on Datacenter and ISP, choose rotating, sticky or static in the Proxy generator of your order.

Give each logical session its own session number and its own cookie jar. Two workers sharing one number share one IP, which doubles the load on it.

How do you keep the client consistent?

Send one complete, unchanging browser identity for the whole session. Sites compare what a client claims to be with how it behaves. Inconsistency gets flagged more often than any single header.

Which proxy type fits which target?

Start with datacenter proxies and move up only when a target requires it; that order keeps costs down. Address reputation is the one factor you fix by changing proxies.

The comparison in residential vs datacenter proxies includes a cost example for the first and third options.

Which site rules should you follow?

Read robots.txt and the terms of service before you start, and follow both. The most durable way to avoid a ban is to not give the operator a reason for one. Collect public data only, stay out of paths the site disallows, and use an official API or data export when one exists; it is faster for you and cheaper for them. Always comply with website terms of service and applicable laws.

No proxy product, ours included, is a promise that a particular site will never block you. What a proxy network gives you is enough addresses in the right places to run a polite crawler at a useful scale.

What should you do after a ban?

Stop, find the cause in your logs and fix it before you send another request to that domain.

  1. Stop the job for that domain. Continuing from new addresses with the same behavior burns those addresses too.
  2. Find the trigger in your logs. Look at the request rate, the error sequence and the last successful responses before the block.
  3. Fix the cause. Lower concurrency, add jitter, repair headers, or change the session strategy.
  4. Resume slowly. Restart at a fraction of the previous rate and raise it in steps while watching the warning signs above.
  5. Move up a proxy tier only if behavior was not the cause. If a careful client still fails on datacenter IPs, test the same URLs on ISP or residential.

For the wider workflow, from planning to monitoring, continue with web scraping best practices or the web scraping use case.

Frequently asked questions

How long does an IP ban last?

It depends on the site. Rate-limit blocks often clear within minutes or hours, while a manual or reputation-based block can stay much longer. Treat every ban as a signal to change behavior, not as a timer to wait out.

Does rotating the IP on every request prevent bans?

It lowers the load per address, which helps with rate and volume limits. It does not help if the requests share an obvious pattern, and it hurts on logged-in flows, where a sticky session is the right choice.

How many requests per second are safe?

There is no universal number. Start low, for example one request every few seconds per domain, watch response times and 429 responses, and raise the rate in small steps. Use the site's Crawl-delay value when robots.txt provides one.

Should I use residential proxies for everything to be safe?

No. Many targets work on datacenter IPs at a much lower cost. Start with Datacenter, and move specific domains to ISP or Residential only when a well-behaved client still fails there.

What does HTTP 429 mean?

Too Many Requests. The server is rate limiting your client. Wait for the time given in the Retry-After header if there is one, then continue at a lower rate.

Run your crawler on the right IPs

Create an account, choose your proxy type and plan, and your proxy credentials are generated automatically once payment is confirmed.