Webshare Guides

Webshare Sticky Sessions: How to Keep the Same IP Across Requests

How to hold the same IP with Webshare using session suffixes on the backbone gateway or fixed IPs in direct mode, when sessions end, and how to design scrapers and bots around them.

By Team of Monkeys Editorial Updated 5 min read Affiliate disclosure

This guide contains affiliate links to Geonode and Webshare. If you buy through them we may earn a commission, at no extra cost to you.

Webshare Sticky Sessions illustration showing Session connecting through Same IP to Website, covering session, rotate, static 3jdej38j4

What a sticky session is

A sticky session keeps the same exit IP for a series of requests. You need one whenever a website ties state to your IP: logins, shopping carts, multi-step forms, paginated results and anything with a session cookie the site checks against your address. The concept is covered in sticky vs rotating sessions.

Webshare gives you two ways to get stickiness.

Option 1: session suffix on the backbone

On the backbone gateway, the username controls behaviour. Webshare's documentation describes adding a session number to the username: every request that uses the same session number goes through the same exit IP, for as long as that session lasts. Using a different number gives you a different IP. The rotate suffix and a session number can't be combined, since they ask for opposite things.

Conceptually:

text
USERNAME-rotate        new IP on every request
USERNAME-1             session 1, same IP while it lasts
USERNAME-2             session 2, a different IP

Copy the exact format from your dashboard's endpoint generator, because it depends on the product and plan.

Option 2: a fixed IP in direct mode

With a datacenter or static residential plan, every proxy in your list is a fixed IP. Connecting directly to one entry gives you a session that lasts as long as you keep using it. That's the most stable kind of stickiness there is, and it's the right choice for accounts and long-lived identities. See backbone vs direct connection.

How long residential sessions last

Rotating residential IPs come from real household connections. When a device disconnects, the IP leaves the pool, and any session on it ends early. Webshare doesn't promise a fixed lifetime for every residential session, so design for interruption:

  • Keep flows short. Log in, do the task, finish. Don't hold a residential session open for hours.
  • Detect IP changes. If a session's IP changes mid-flow, restart the flow cleanly.
  • Retry with a new session number rather than the same one after failures.

If you need hours-long, guaranteed stickiness, use a static residential IP instead. For comparison, Geonode advertises residential sticky sessions up to 24 hours; see Webshare vs Geonode sticky sessions.

Designing around sessions

Scrapers. Use rotation for independent pages, and a session per crawl path for paginated listings. Generate session numbers per job so parallel workers never share one by accident.

python
import requests, uuid

def session_proxy(user, pw):
    sid = uuid.uuid4().int % 1_000_000
    url = f"http://{user}-{sid}:{pw}@p.webshare.io:80"
    return {"http": url, "https": url}

s = requests.Session()
s.proxies = session_proxy("USERNAME", "PASSWORD")
for page in range(1, 6):
    s.get(f"https://example.com/list?page={page}", timeout=30)

Browsers. Give each browser context its own session (or its own fixed IP), and keep cookies and IP together. See Webshare with Puppeteer and Webshare with Playwright.

Accounts. Don't use rotating residential sessions for accounts at all. Use one dedicated static IP per account.

Budget tip: Before scaling, run a short pilot with Webshare on your real targets and record success rate, latency and bandwidth per result. Our our complete Webshare guide explains which Webshare product fits which job.

Rotation vs sessions: quick guide

TaskUse
Thousands of independent product pagesRotate
Paginated search resultsSession per search
Login, then a few actionsSession, kept short
Daily account managementFixed static residential IP
CheckoutFixed static residential IP, or a short session

Choosing session IDs

Session IDs are just numbers you choose, but the way you choose them matters:

  • Random per flow. Generate a new ID for each login, cart or crawl path.
  • Stable per identity when you deliberately want the same residential IP to be reused for a short period (for example, a few minutes of browsing for one profile).
  • Never shared across parallel workers unless you want them to look like one user.

Log the session ID with each request so you can trace problems later.

Detecting a session change

For important flows, check the exit IP at key points:

python
def exit_ip(s):
    return s.get("https://httpbin.org/ip", timeout=15).json()["origin"]

start = exit_ip(s)
# ... perform steps ...
if exit_ip(s) != start:
    raise RuntimeError("session IP changed; restart the flow")

Restarting cleanly is better than continuing with a new IP and a cookie the site associates with the old one.

Sessions in browsers

In browser automation, a session should map to a browser context. Give each context its own session ID, and close the context when the flow ends. That keeps cookies, storage and IP together. See Webshare with Playwright.

Proxy tip: For a second opinion on hard targets, run the same test through Geonode residential proxies, which support sticky sessions up to 24 hours and ASN targeting. We compare the two in Webshare vs Geonode.

Common mistakes

  • Using rotate for logins.
  • Reusing one session ID for every worker.
  • Holding residential sessions open for hours.
  • Forgetting that sessions don't apply in direct mode: a direct IP is already fixed.

A real-world example

A team collects search results that span 10 pages per query on a travel site. With the rotate option, page 3 often returned a "session expired" error. They switch to a session username per query and a new requests.Session per query, so cookies and IP travel together. Errors drop to near zero, and when a residential IP occasionally drops mid-query, their code detects the IP change and restarts that query with a new session number.

Not sure this is the right proxy type for the job? The best proxies in 2026 guide compares residential, ISP, datacenter and mobile options, and our cheap proxies guide covers budget picks that still work.

Key takeaways

  • A session number in the backbone username keeps the same exit IP; a rotate suffix gives a new IP per request.
  • Direct IPs from datacenter and static residential lists are already fixed.
  • Residential sessions can end early when a device goes offline, so design flows to detect and restart.
  • Generate a unique session ID per flow and per worker.
  • Use static residential IPs for long or account-based sessions.

FAQ

Does Webshare support sticky sessions?

Yes. Use a session number in the backbone username for residential traffic, or a fixed IP from your list in direct mode.

Can two of my workers share one session?

They can if they use the same session number, but it's usually a mistake, because both will look like one user. Give each worker its own.

Why did my sticky session change IP?

Residential IPs can go offline. Build retries and session restarts into your flow, or use static residential IPs for long sessions.

How do I end a sticky session?

Stop using that session number. Use a new number for the next flow.

Do sticky sessions cost more?

No. Residential traffic is billed by bandwidth whether you rotate or hold a session.

Can I use sticky sessions with datacenter proxies?

Direct datacenter IPs are already fixed. On the backbone, session usernames hold the same IP from your list.

Affiliate disclosure: Team of Monkeys is an affiliate of Geonode and Webshare. Links and banners marked as sponsored, and links to Geonode and Webshare in the text, use our referral links, and we may earn a commission if you buy through them, at no extra cost to you. Our explanations and comparisons are written to be useful whichever provider you choose.

Editorial note: Proxy providers change their pools, features and prices often, so treat any figures here as typical ranges at the time of writing and confirm current terms with the provider before you buy.