Skip to content

What is a sticky session?

A sticky session is a proxy setting that keeps one exit IP across connections for a set time. The client sends the same session name with each request, and the proxy reuses the assigned exit while that IP stays available. Rotating sessions change the exit per connection or request; static proxies keep one fixed IP for the whole term.

Updated

How a sticky session works

Most residential proxy services take the session in the proxy username, for example YOUR_USERNAME-session-cart01. The gateway maps each session name to an exit. The first connection with a new name gets an exit from the pool; later connections with the same name go out through it until the session duration ends or the IP leaves the pool. A different name asks for a different exit, though two names can land on the same one.

Residential exits are household connections, so a sticky IP can disappear early when the device goes offline or the ISP reassigns the address. Treat the duration as an upper bound, not a promise. Services also count it differently: from the first request, from the last, or in fixed clock windows, where a session that starts two minutes before a boundary keeps its IP for two minutes.

Sticky vs rotating sessions

Pick by whether the steps of a job depend on each other.

Rotating and sticky sessions compared
QuestionRotatingSticky
When the exit changesOn a new connection (on some services, each request)When the session duration ends or the IP leaves the pool
FitsIndependent requests: product pages, search results, price checksFlows with state: sign-in, cart, checkout, multi-page forms
Load on one IPSpread across many exitsConcentrated on one exit
What breaksA flow whose steps arrive from different IPsPer-IP rate limits when too many requests share one exit

A kept-alive connection stays on one exit even in rotating mode, so a test that reuses connections can make rotation look sticky. Rotating proxies vs sticky sessions covers rotation models and username forms.

Sticky session vs static proxy

A static proxy is an address assigned to you for the term you pay for, such as a datacenter IP or a static ISP address. It does not depend on a household device staying online, and when it is dedicated, nobody else sends traffic from it. A sticky session borrows an address from a shared pool for minutes or hours, then gives it back.

Choose static when a destination must see the same IP for days or weeks: a long-lived account, or an API that accepts only whitelisted addresses. Choose sticky when the flow lasts minutes to hours and the next one can start on a fresh residential IP.

Not the same as load-balancer sticky sessions

A load balancer with sticky sessions, also called session affinity, sends every request from one client to the same backend server, usually by cookie or by hashing the client's IP. A proxy sticky session works at the other end of the connection: it keeps the IP the destination sees the same.

How long a sticky session should be

Set the session duration to the longest flow you run plus a margin, not to the most the service allows. A checkout that takes four minutes needs ten, not 24 hours. A longer session puts more requests on one IP and raises the chance that the household connection drops mid-flow.

Give each account, browser profile or job its own session name. One name reused across unrelated jobs puts them all on one IP.

How to test a sticky session

Send the same session name to an IP echo service at an interval and log each exit with a timestamp. The point where the IP changes is the hold time you measured for that time of day:

Log a sticky exit once a minute for ten minutes
for i in $(seq 1 10); do
  printf '%s ' "$(date -u +%H:%M:%S)"
  curl -s -x http://YOUR_HOST:YOUR_HTTP_PORT \
    -U "YOUR_USERNAME-session-test01-lifetime-1800:YOUR_PASSWORD" \
    https://api.ipify.org
  echo
  sleep 60
done

lifetime-1800 asks for 30 minutes; leave it out on a service that has no session duration setting. Then run the real flow, because a site can stop answering one IP while that IP still works elsewhere.

Common mistakes

  • A new session name on retry. A retry wrapper that rebuilds the username loses the IP the flow started on.
  • Ignoring the cookie and IP pair. If the exit changes mid-login, the site sees your cookies arrive from a new address and may ask you to sign in again. Restart the flow on a new session rather than carry on.
  • Bulk collection on one session. Hundreds of parallel requests on one sticky IP hit per-IP rate limits that rotation would have spread out.

Sticky sessions on TrueProxies

The Proxy setup tab offers three session types: Rotating, Sticky and Sticky ports. Sticky adds -session- and a name of 1 to 32 letters or digits to the username, plus -lifetime- in seconds where the product accepts a session duration. Sticky ports suit tools that take one proxy per host and port: each port, SOCKS5 10000–10999 or HTTP 20000–20999, keeps one sticky IP for up to 24 hours while that IP stays available.

Session duration by product
ProductSession duration you can setWhen none is set
Residential IPv4 Standard1 second to 24 hours10 minutes
Residential IPv4 Premium3 minutes to 24 hours10 minutes
Unlimited Bandwidth1 minute to 24 hours, in whole minutes10 minutes
Unlimited Pro1 minute to 24 hours, in whole minutes10 minutes
Residential IPv4 LiteNone: the IP holds while the session keeps being usedNot applicable
Datacenter IPv6 and Residential IPv61 minute to 24 hours, in UTC clock windows10 minutes

Sessions are best effort. On Residential IPv4, when one site stops answering through a sticky IP that still works elsewhere, the session keeps its IP and that connection gets No response; retry the request. The connection reference has the full syntax.

Questions about sticky sessions

How long does a sticky session last?

As long as the session duration you set, unless the exit IP leaves the pool first. On TrueProxies Residential IPv4 that is up to 24 hours, with 10 minutes when none is set; Residential IPv4 Lite holds the IP while the session keeps being used.

Is a sticky proxy the same as a static proxy?

No. A sticky session reuses an IP from a shared pool for a limited time. A static proxy is a fixed address assigned to you for your plan's term. Use static when a destination must see one IP for days; use sticky for flows that last minutes or hours.

Can two sticky sessions get the same IP?

Yes. A session name requests an exit; it does not reserve an address for you alone. When separation matters, give each account its own session name and check the exit IPs.

Why did my sticky session change IP early?

Either the household connection behind it went offline or was reassigned, or the client sent a different session name, often from a retry that rebuilt the username. Log the username your tool sends with each request to rule out the second cause.

Should I use sticky sessions for web scraping?

Only for the steps that need state, such as a sign-in or a paginated search tied to a session. Independent page loads spread better over rotating sessions.