The essential points from this guide -- each one is explained in detail below.
A session ID in the proxy username pins a specific exit IP to all requests carrying that ID.
Session durations typically range from 1 to 30 minutes, depending on the provider and proxy type.
Sessions break when the exit IP becomes unhealthy, the duration expires, or the underlying peer disconnects.
Session-aware scraping uses unique session IDs per logical workflow (login, browse, checkout) to maintain state.
When you send a request through a backconnect gateway with a session ID in the username (for example, user-session-order42), the gateway hashes that ID to select a specific exit IP from the pool. Every subsequent request with the same session ID routes through that same IP, as long as the session is active. This is often called a "sticky session" because the IP sticks to your session identifier.
The session ID can be any arbitrary string. Most implementations hash it (SHA-256 or CRC32) and map the result to an index in the active IP pool. This means the same session ID deterministically selects the same IP without requiring the gateway to store session state in a database -- the mapping is computed on each request. If the selected IP is unavailable, the gateway falls back to the next candidate in the hash ring.
Session duration defines how long the IP assignment stays active. Residential proxy sessions typically last 1-10 minutes, limited by the availability of the underlying peer connection. ISP and datacenter proxy sessions can last hours or indefinitely because the IPs are hosted on stable infrastructure. KnoxProxy supports session durations from 1 to 30 minutes on residential proxies, configured via the sessTime parameter.
When a session expires, the next request with the same session ID gets assigned a new IP from the pool. To extend a session, you can send a keepalive request before the timer runs out. Some providers auto-extend sessions as long as traffic continues flowing, resetting the timer on each request.
Sessions can break for three reasons: the duration timer expires, the exit IP becomes unhealthy (the underlying peer goes offline or gets banned), or the gateway restarts. Your scraping code should detect session breaks by monitoring for unexpected IP changes (via response headers like X-Proxy-IP) or by catching authentication failures on the target site.
Robust session handling follows a retry pattern: if a request fails with a 403 or the session appears broken, generate a new session ID and restart the workflow from the last checkpoint. For critical multi-step flows (like completing a checkout), store intermediate state so you can resume with a new session rather than restarting from scratch.
The most effective pattern assigns one unique session ID per logical task. If you are scraping product pages, each product gets its own session ID, so all requests for that product (listing page, detail page, reviews) come from the same IP. This mimics natural browsing behavior and avoids triggering anti-bot systems that flag IP changes mid-session.
For account management tasks (social media, e-commerce accounts), assign a persistent session ID per account and reuse it across sessions. Pair the session with consistent browser fingerprint headers (User-Agent, Accept-Language) so the combination of IP and fingerprint remains stable. If the platform uses cookie-based session tracking, the proxy session ensures cookies are sent from the same IP that received them.
user-session-myID123-sessTime-10 pins the same IP for 10 minutes. Any requests with the same session ID route through that IP.Ready to put this into practice? Browse Sticky-Session Proxies
KnoxProxy Research Team · Technical Content
Network engineers and proxy infrastructure specialists with 10+ years in anti-bot systems, web scraping, and IP routing.
90.4M+ ethically sourced residential IPs across 195 countries. Start free -- no credit card required.