Residential Proxy Rotation Strategies
Effective IP rotation is the foundation of successful large-scale scraping and automation. Hex Proxies provides access to 10M+ residential IPs with automatic rotation through the `gate.hexproxies.com` gateway.
Rotation Modes
#### Per-Request Rotation (Default)
Every request through `gate.hexproxies.com` without a session tag automatically uses a different IP:
proxy = "http://YOUR_USERNAME:YOUR_PASSWORD@gate.hexproxies.com:8080" proxies = {"http": proxy, "https": proxy}
# Each request gets a different IP for i in range(10): resp = requests.get("https://httpbin.org/ip", proxies=proxies, timeout=15) print(f"Request {i}: {resp.json()['origin']}") ```
#### Timed Sticky Sessions
Hold the same IP for a set duration by appending a session ID to the username:
session_proxy = "http://YOUR_USERNAME-session-timer001:YOUR_PASSWORD@gate.hexproxies.com:8080"# All requests within the session window use the same IP for page in range(1, 6): resp = requests.get(f"https://example.com/page/{page}", proxies=session_proxies) print(f"Page {page}: {resp.status_code}") ```
#### Geographic Rotation
Target specific countries or cities to test geo-restricted content or distribute load across regions:
for region in regions: regional_proxy = f"http://YOUR_USERNAME-country-{region}:YOUR_PASSWORD@gate.hexproxies.com:8080" resp = requests.get("https://httpbin.org/ip", proxies={"http": regional_proxy, "https": regional_proxy}) print(f"{region}: {resp.json()['origin']}") ```
Rotation Strategy by Use Case
| Use Case | Strategy | Session Type | |----------|----------|--------------| | Product price monitoring | Per-request | Rotating | | Social media scraping | Timed sticky (5-10 min) | Sticky | | Login + scrape workflows | Sticky for login, rotate for scraping | Mixed | | SEO rank checking | Per-request with geo targeting | Rotating | | Ad verification | Geographic rotation | Rotating |
Scaling Rotation
def scrape_url(url): proxy = "http://YOUR_USERNAME:YOUR_PASSWORD@gate.hexproxies.com:8080" try: resp = requests.get(url, proxies={"http": proxy, "https": proxy}, timeout=20) return (url, resp.status_code, len(resp.content)) except requests.RequestException as e: return (url, 0, str(e))
urls = [f"https://example.com/product/{i}" for i in range(100)]
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor: results = list(executor.map(scrape_url, urls))
success_rate = sum(1 for _, status, _ in results if status == 200) / len(results) print(f"Success rate: {success_rate:.1%}") ```
Anti-Detection Patterns
- Vary request timing with random delays (1-5 seconds between requests).
- Rotate User-Agent headers alongside IP rotation.
- Respect robots.txt and rate limits.
- Use residential IPs for protected targets, ISP proxies for speed-critical tasks.
- Monitor success rates and switch strategies if blocks increase.
Monitoring Rotation Quality
Track these metrics to evaluate your rotation strategy:
- **Success rate**: Percentage of 200 responses. Target 95%+ for well-configured rotation.
- **Unique IPs per hour**: Higher diversity reduces detection risk.
- **Block rate**: Percentage of 403/429 responses. Increase rotation speed if this rises.
- **Latency distribution**: Identify slow regions and adjust geographic targeting.