Webshare exposes unified HTTP (:80) and SOCKS5 (:1080) routing through p.webshare.io alongside direct IP:port lists synced via REST API v2 (https://proxy.webshare.io/api/v2/proxy/list/ using Authorization: Token <API_KEY>). Always use socks5h:// rather than socks5:// to prevent local DNS leaks, and enable IP whitelisting (sourceip) or HTTP :80 when automating Chromium/Playwright because Chromium rejects inline user/pass credentials on SOCKS5 URLs.
HTTP CONNECT (:80) vs. SOCKS5 (:1080) Protocol Mechanics & DNS Leaks
Most developer tutorials treat HTTP proxies and SOCKS5 proxies as interchangeable URL strings, yet their OSI layer behavior differs in ways that break authentication, leak local DNS telemetry, or stall TLS handshakes. On Webshare's unified p.webshare.io backbone and direct proxy nodes, port 80 handles HTTP and HTTPS CONNECT tunneling at the application layer (Layer 7), whereas port 1080 implements the lower-level SOCKS5 session protocol (Layer 5).
When an application sends an HTTPS request over an HTTP proxy on p.webshare.io:80, the client transmits a plaintext HTTP CONNECT target:443 header asking the proxy to open a TCP pipe to the remote server. Once the proxy answers 200 Connection Established, end-to-end TLS encryption flows straight from your client library to the destination origin without Webshare inspecting payload bytes. For plain HTTP traffic (unencrypted port 80 targets), however, HTTP proxies parse and forward standard HTTP request lines directly.
SOCKS5 on p.webshare.io:1080 operates purely as a binary socket-level forwarder agnostic to upper-layer protocols. It neither inserts Via or Proxy-Connection headers nor transforms application framing—making it cleaner for custom TCP sockets, WebSockets, SSH tunnels, SMTP/IMAP checks, and TLS-impersonating scrapers that want zero HTTP proxy header fingerprints.
The single deadliest configuration mistake engineers commit with SOCKS5 is confusing socks5:// with socks5h:// in curl, Python httpx, requests, or Scrapy. Standard socks5:// forces your local workstation or cloud server to look up the target domain name via your own local DNS resolver before passing the resolved IPv4 address over port 1080. That exposes every target domain you scrape to your cloud provider or ISP DNS logs and breaks geo-targeted CDN routing where target servers resolve different regional IPs depending on the exit country. Always specify socks5h:// (or --socks5-hostname in curl) so Webshare's remote exit node performs DNS resolution inside the target jurisdiction.
| Protocol Attribute | HTTP / HTTPS Proxy (:80) | SOCKS5 Proxy (:1080) | Engineering Takeaway |
|---|---|---|---|
| OSI Network Layer | Layer 7 (HTTP / CONNECT tunnel) | Layer 5 (Binary socket forwarder) | SOCKS5 supports any TCP stream transparently |
| Remote DNS Resolution | Automatic via hostname in CONNECT | Requires socks5h:// (NOT socks5://) | Verify socks5h:// to avoid local ISP DNS leaks |
| Chromium / Playwright Auth | Supports inline user/pass natively | Blocks inline user/pass on socks5:// | Use sourceip whitelist or HTTP :80 in Chromium |
| Corporate Firewall Traversal | Port 80 rarely blocked on egress | Port 1080 occasionally filtered on VPCs | Test port 1080 egress in CI before deploying |
| Protocol Flexibility | HTTP / HTTPS / WebSocket over HTTP | HTTP, WebSocket, raw TCP, custom TLS | Prefer SOCKS5h for non-HTTP & leak-free TLS |
Writing socks5://user:[email protected]:1080 in Python requests or curl leaks target domain lookups through your host machine's /etc/resolv.conf before tunneling begins. Switch the scheme to socks5h:// (the 'h' enables remote hostname resolution) so target DNS resolves strictly from Webshare's exit node.
Backbone Mode (p.webshare.io) vs. Direct Proxy List Endpoints
Webshare structures proxy delivery around two complementary endpoint_mode architectures: backbone and direct. Knowing when to point workers at the single p.webshare.io backbone hostname versus hydrating an explicit list of assigned IP:port addresses determines how cleanly your scraping cluster scales, handles IP replacements, and maintains session stickiness.
In backbone mode, every connection resolves to p.webshare.io (port 80 for HTTP or port 1080 for SOCKS5). Routing logic lives inside the proxy username string itself rather than across hundreds of separate host sockets. For example, connecting with username-rotate dynamically assigns a new IP per connection across your active subscription pool, while username-1 or username-sess94 pins consecutive connections onto a consistent exit IP. Across Rotating Residential plans (80M+ home IPs across 195+ countries), backbone mode is mandatory because individual home peers join and leave dynamically behind the gateway.
In direct mode (available across Free 10, Datacenter, and Static Residential ISP pools), Webshare assigns explicit static IPv4 addresses and unique port numbers—retrieved programmatically via REST API v2 with mode=direct. Direct mode lets your scraper hold persistent local telemetry per endpoint: tracking exact 200 vs 429 error counters per IPv4 address in Redis, isolating one Dedicated IP strictly to one Playwright profile directory, or binding long-lived WebSocket feeds to specific regional subnets.
Smart hybrid infrastructures frequently employ both modes side by side: Direct mode for Static ISP social accounts and Dedicated Datacenter orderbook pollers where exact 1-to-1 IP mapping matters, and Backbone mode (p.webshare.io) for stateless rotating crawlers and Rotating Residential fallback pools.
- Backbone mode (p.webshare.io:80 / :1080) requires zero IP-list refreshes when scaling from 100 to 10,000 Datacenter IPs or using 80M+ Residential peers.
- Direct mode returns explicit IP:port tuples ideal for deterministic round-robin queues, Redis per-IP backoff tracking, and 1-to-1 social profile mapping.
- Disable HTTP Keep-Alive connection reuse when sending -rotate requests over p.webshare.io so every HTTP request establishes a fresh TCP tunnel.
- On Direct mode Datacenter or Static ISP lists, configure automatic proxy replacement polling so replaced endpoints drop cleanly out of active worker memory.
REST API v2 Specification: Listing, Filtering & Stateless Download URLs
Hardcoding proxy IP addresses inside repository configuration files causes silent production outages whenever plans resize, subnets rotate, or expired free/paid endpoints replace. Webshare solves inventory synchronization cleanly across every tier—including the permanent 10-IP free plan—through REST API v2 under https://proxy.webshare.io/api/v2/.
Authenticated API requests pass your secret key inside an Authorization header formatted strictly as Authorization: Token <API_KEY>. To fetch structured metadata for programmatic schedulers, call GET https://proxy.webshare.io/api/v2/proxy/list/ with query parameters including mode (direct or backbone), page, and page_size. Each returned proxy object exposes id, username, password, proxy_address, port, valid status boolean, last_verification timestamp, country_code, city_name, and created_at—allowing automated pipelines to verify health flags and filter exits by country before pushing routes into workers.
For lightweight DevOps scripts, shell pipelines, Docker entrypoints, and third-party proxy rotators that prefer flat text files over JSON pagination, Webshare also exposes a deterministic stateless download URL: https://proxy.webshare.io/api/v2/proxy/list/download/{token}/{country_codes}/any/{authentication_method}/{endpoint_mode}/{search}/. The embedded {token} authenticates list retrieval without sending Authorization headers, while URL path segments parameterize ISO country codes (or '-' for all), authentication_method (username vs sourceip), and endpoint_mode (direct vs backbone).
Never hammer the REST API v2 list endpoint inside per-request scraping loops. Pulling your proxy list once at container boot and refreshing asynchronously every 5 to 15 minutes inside a background worker or Redis cache respects API rate ceilings while guaranteeing fresh endpoint alignment.
- Generate an API v2 key inside the Webshare dashboard API settings and inject it strictly via environment secrets (never commit tokens to Git).
- Select mode=direct for explicit IP:port lists (Free 10, Datacenter, Static ISP) or mode=backbone when driving unified p.webshare.io pools.
- Filter returned results on valid === true before inserting endpoints into live scraper worker queues.
- Store synced proxy records in Redis or local ephemeral memory with a 300-second to 900-second TTL rather than querying API v2 on every outbound scrape.
# 1. Fetch paginated JSON inventory (direct endpoints, page 1, 100 per page)
curl -sS "https://proxy.webshare.io/api/v2/proxy/list/?mode=direct&page=1&page_size=100" \
-H "Authorization: Token ${WEBSHARE_API_KEY}" | jq '.count, .results[0]'
# 2. Fetch backbone gateway configuration via API v2
curl -sS "https://proxy.webshare.io/api/v2/proxy/list/?mode=backbone&page=1&page_size=10" \
-H "Authorization: Token ${WEBSHARE_API_KEY}"
# 3. Stateless plain-text download endpoint (US + GB only, username auth, direct IP:port)
curl -sS "https://proxy.webshare.io/api/v2/proxy/list/download/${WEBSHARE_DL_TOKEN}/US,GB/any/username/direct/-/" -o proxies_us_gb.txt
# 4. Stateless download formatted for IP-whitelisted sourceip authentication
curl -sS "https://proxy.webshare.io/api/v2/proxy/list/download/${WEBSHARE_DL_TOKEN}/-/any/sourceip/direct/-/" -o proxies_ip_auth.txt
IP Whitelist (sourceip) vs. Username/Password Authentication Architecture
Webshare lets subscribers authenticate proxy tunnels using username/password credentials (username mode), source IP whitelisting (sourceip mode), or both concurrently depending on plan configuration. Choosing between them is an architectural security decision dictated by where your workers run and which browser or HTTP runtime opens the socket.
Username/password authentication is mandatory whenever your automation executes from environments with dynamic or shared outbound IP addresses—such as AWS Lambda, Google Cloud Run, Vercel serverless cron jobs, GitHub Actions CI runners, or developer laptops on changing home/office Wi-Fi. It is also required whenever you want per-connection routing modifiers (-rotate, country suffixes, and sticky -{session_id} tags) passed directly in the proxy username on p.webshare.io.
Source IP whitelisting (sourceip), by contrast, binds access exclusively to static public IPv4 egress addresses registered in your Webshare dashboard (such as a fixed cloud NAT Gateway or Hetzner dedicated box). Once whitelisted, your code connects simply to http://host:port or socks5://host:port with zero embedded passwords—preventing credential leakage in process argument lists (`ps aux`), CI logs, or browser command flags.
Crucially, source IP whitelisting unlocks native Chromium/Playwright SOCKS5 support. Because Chromium refuses username/password authentication on socks5:// proxy URLs due to upstream browser security restrictions, teams running Playwright or Puppeteer over Webshare port 1080 must either switch to IP whitelist mode (sourceip), fall back to HTTP port 80 (which Chromium supports natively with user/pass), or run a lightweight localhost forwarder like pproxy or 3proxy.
| Criteria | Username/Password (username) | IP Whitelist (sourceip) | Engineering Best Practice |
|---|---|---|---|
| Serverless / Dynamic Egress IPs | Works anywhere immediately | Fails if container egress IP shifts | Use username on Lambda/Cloud Run/local laptops |
| Playwright / Chromium SOCKS5 (:1080) | Blocked natively by Chromium | Works natively with socks5://host:1080 | Enable sourceip for Playwright SOCKS5 or use HTTP :80 |
| -rotate & Sticky Session Suffixes | Full inline username modifier support | Not passed via username strings | Use username mode for -rotate and -{session_id} |
| Secret Hygiene in CLI / Process Lists | Credentials sit in proxy URL strings | Zero secrets in launch arguments | Prefer sourceip on fixed VPC NAT gateways |
Seeing net::ERR_NO_SUPPORTED_PROXIES or an empty proxy auth hang in Playwright over port 1080? Either whitelist your server IP in Webshare so Playwright omits user/pass from socks5://host:1080, or route Playwright over Webshare's HTTP proxy on port 80 where Chromium handles user/pass authentication natively.
Production Sync Client: REST API v2 Hydration & Dual-Protocol Routing
To eliminate hardcoded credentials and stale lists across microservices, wrap Webshare REST API v2 inside a reusable proxy-registry helper that refreshes endpoints gracefully, supports both direct IP pools and p.webshare.io backbone URLs, and handles HTTP 407 or network errors deterministically.
The Python module below demonstrates a self-healing Webshare registry class that authenticates with Authorization: Token <API_KEY>, fetches all active direct proxies across paginated responses, validates SOCKS5h connectivity cleanly, and exposes fallback backbone credentials with optional sticky session or -rotate formatting.
import os
import time
import random
import httpx
class WebshareRegistry:
BASE_URL = "https://proxy.webshare.io/api/v2/proxy/list/"
def __init__(self, api_key: str, refresh_ttl: int = 600):
self.api_key = api_key
self.refresh_ttl = refresh_ttl
self._proxies: list[dict] = []
self._last_sync = 0.0
def sync_direct_pool(self, country_code: str | None = None) -> list[dict]:
if self._proxies and (time.monotonic() - self._last_sync) < self.refresh_ttl:
return self._proxies
headers = {"Authorization": f"Token {self.api_key}"}
collected = []
page = 1
with httpx.Client(timeout=15.0) as client:
while True:
params = {"mode": "direct", "page": page, "page_size": 100}
if country_code:
params["country_code__in"] = country_code
resp = client.get(self.BASE_URL, headers=headers, params=params)
if resp.status_code == 429:
time.sleep(2.0)
continue
resp.raise_for_status()
payload = resp.json()
valid_items = [p for p in payload.get("results", []) if p.get("valid")]
collected.extend(valid_items)
if not payload.get("next"):
break
page += 1
self._proxies = collected
self._last_sync = time.monotonic()
return self._proxies
def pick_direct_uri(self, scheme: str = "socks5h", source_ip_auth: bool = False) -> str:
pool = self.sync_direct_pool()
if not pool:
raise RuntimeError("No valid Webshare direct proxies returned by REST API v2")
node = random.choice(pool)
if source_ip_auth:
return f"{scheme}://{node['proxy_address']}:{node['port']}"
return f"{scheme}://{node['username']}:{node['password']}@{node['proxy_address']}:{node['port']}"
@staticmethod
def backbone_uri(username: str, password: str, scheme: str = "socks5h", suffix: str = "rotate") -> str:
port = 1080 if scheme.startswith("socks5") else 80
auth_user = f"{username}-{suffix}" if suffix else username
return f"{scheme}://{auth_user}:{password}@p.webshare.io:{port}"
if __name__ == "__main__":
registry = WebshareRegistry(api_key=os.environ["WEBSHARE_API_KEY"])
proxy_uri = registry.pick_direct_uri(scheme="socks5h")
with httpx.Client(proxy=proxy_uri, timeout=15.0) as c:
r = c.get("https://api.ipify.org?format=json")
print("Synced direct SOCKS5h IP:", r.json())
Diagnosing Proxy Errors: 407 Auth, WebRTC Leaks & Timeout Calibration
Production troubleshooting becomes fast once you map HTTP and socket status codes directly to Webshare's proxy gateway layers. Most silent scraping glitches stem not from remote target blocking, but from misconfigured local credentials, stale whitelisted NAT IPs, or inappropriate timeout windows.
Receiving HTTP 407 Proxy Authentication Required on port 80—or SOCKS5 authentication handshake failure on port 1080—always points to your client-to-Webshare auth boundary rather than the destination site. Common causes include pasting an expired dashboard password after credential rotation, omitting a required routing suffix, sending requests from an unwhitelisted server IP when sourceip-only mode is active, or mixing a Rotating Residential username against a Datacenter endpoint configuration.
Connection timeouts and resets inside p.webshare.io splits neatly by tier. On Datacenter and Static ISP endpoints, connect timeouts above 5 seconds typically signal an outbound firewall on your host blocking TCP port 1080 (SOCKS5) or transient NAT port exhaustion on your own Linux kernel (check net.ipv4.ip_local_port_range and conntrack limits under heavy concurrency). On Rotating Residential peers, however, 600ms to 3,000ms latency spikes are normal broadband behavior, so client read timeouts must sit between 15 and 25 seconds.
For browser privacy and anti-fingerprinting setups using SOCKS5, audit WebRTC STUN leakage and timezone alignment explicitly. Even when every HTTPS request exits cleanly via socks5h://p.webshare.io:1080, unprotected WebRTC ICE candidates in default desktop or headless browsers can broadcast your real server LAN or public IP directly over UDP unless restricted via browser policy flags.
- HTTP 407 / SOCKS Auth Fail: verify dashboard credentials, check active IP whitelist entries if using sourceip, and ensure no trailing whitespace entered env variables.
- TCP Port 1080 Connect Timeout: validate security group or corporate firewall egress rules permit outbound TCP 1080, or fail over cleanly to HTTP CONNECT port 80.
- DNS Leak Check: confirm target hostnames resolve inside the target proxy country using dnsleaktest or browserleaks endpoints via socks5h://.
- Kernel Ephemeral Ports: on high-concurrency Linux scrapers (>500 sockets/sec), enable TCP socket reuse cleanly or expand net.ipv4.ip_local_port_range.
Honest Caveats, Secret Rotation & CI/CD Hardening
Even with a clean control plane, engineers should design around real-world operational constraints. First, Webshare's REST API v2 enforces rate limits on high-frequency API queries; polling /api/v2/proxy/list/ prior to every individual scraping request will trip API HTTP 429 throttling and bottleneck your workers. Always hydrate proxy lists at a shared coordinator level (Redis or worker startup cache) with 5-to-15 minute refresh intervals.
Second, keep API keys and proxy passwords separated cleanly. A leaked proxy username/password lets an attacker burn your bandwidth quota, whereas a leaked Authorization: Token API key exposes account-wide proxy configuration, IP whitelists, and credential reset endpoints. Store your WEBSHARE_API_KEY solely inside a restricted CI/CD secrets manager used by your sync coordinator, and distribute only scoped runtime proxy credentials or whitelisted VPC NAT paths to scraping worker pods.
Finally, verify protocol requirements before defaulting blindly to SOCKS5. While SOCKS5 on port 1080 avoids HTTP proxy headers and handles non-HTTP TCP sockets cleanly, certain enterprise cloud proxies, strict corporate firewalls, and Chromium user/pass workflows run significantly simpler on HTTP CONNECT port 80. Because every Webshare plan unlocks both protocols at zero extra cost, choosing per workload gives you maximum reliability with zero vendor lock-in.
- Store WEBSHARE_API_KEY exclusively on your orchestration service; distribute synced lists internally to scraping nodes.
- Implement exponential backoff on REST API v2 HTTP 429 responses and cache /proxy/list/ payloads locally for 300+ seconds.
- Monitor proxy validity flags and automatically alert if healthy pool percentage dips below 90% on Direct allocations.
- Standardize environment configuration flags so workers can toggle seamlessly between port 80 HTTP and port 1080 SOCKS5h.