How long does a rotating proxy keep the same IP address?

A Node4 session ID pins one exit for a fixed window from first use, and traffic never extends it. Without one, each new connection can change the IP.

On Node4's rotating datacenter gateways (Rotating Datacenter and Rotating Unmetered), a session ID holds one exit for at most 30 minutes, counted from the moment that exit is first assigned. Requests during the window do not restart the timer. Without a session ID there is no time window at all: each new HTTPS tunnel or SOCKS5 connection gets a fresh exit selection, plain HTTP is selected per request, and a later selection can return an address you had before.

Residential sessions are best effort, with a 30-minute ceiling: the exit can drop sooner if its device goes offline, so switch to a new session ID after repeated failures. If a job needs one address for longer than a session allows and the target accepts datacenter traffic, a static dedicated datacenter proxy keeps its address until you replace it.

What changes the exit, case by case

The gateway hostname never changes, so it tells you nothing about the exit. What matters is which event triggers a new selection:

What your client doesWhen the exit can changeNotes
Opens a new HTTPS tunnel or SOCKS5 connection, no session IDOn every new connectionCan repeat an address used earlier
Sends plain HTTP requests, no session IDOn every requestApplies even when the client keeps its gateway connection open
Reuses one HTTPS tunnel (keep-alive)Not while the tunnel stays openEvery request inside the tunnel leaves from the same exit
Sends a session ID, rotating datacenter gatewayAt most 30 minutes after first assignment, or sooner if the exit failsTraffic does not extend the window
Sends a session ID, residential gatewayAt most 30 minutes after first assignmentBest effort; an offline device ends the session early
Uses a static dedicated proxyOnly when you replace itNot a rotating product

Connection reuse is the case people miss. Most HTTP clients keep connections alive by default, so an HTTPS crawl can rotate far less than expected. The IP rotation guide covers how to force or avoid a fresh exit per request.

Sticky sessions: an upper bound, not a hold

A session first assigned at time T ends no later than T plus 30 minutes on the rotating datacenter gateway, and a request at minute 29 does not push that deadline back. The window is a ceiling. Continuity can end sooner, and what happens next differs by product.

We checked this on our own gateway: in a measured test of Rotating Datacenter, 28 sticky sessions over four test windows each kept one exit through the last check before the 30-minute mark, and sessions used every minute moved on the same schedule as sessions used rarely.

Rotating datacenter gateway. If the pinned exit leaves the pool or fails to open a connection, the gateway picks a working exit and pins the session to it. That replacement starts a fresh window of its own. Your session ID keeps working, but the address the target sees has changed, so treat a change mid-window as a real event in your logs rather than a glitch to retry past.

Residential gateway. A pin whose device goes offline is not replaced before the ceiling passes. Requests on that session ID keep failing, and the fix is a new session ID, not waiting.

After the window ends. The same session ID simply gets a new selection. That selection can land on the address you just had, so an unchanged IP after expiry does not mean the session was extended.

The rotating datacenter gateway also reports what it did, over HTTP. Every response it serves, including the reply that opens an HTTPS tunnel, carries an X-Node4-Sticky header (refusals such as a 407, 429 or 502 do not, and SOCKS5 has no headers, so on SOCKS5 compare the exit address instead): opened when it pinned a new exit, held when it reused the pin, none when it saw no session segment, and unavailable when it could not pin at all. In that last case the request is refused with a 503, which does carry the header, rather than served from a random exit. Check it with verbose curl:

curl -sv \
  --proxy "http://USERNAME-session-job42:PASSWORD@gw-rotating_datacenter.node4.io:8083" \
  -w '\n' https://api.ipify.org 2>&1 | grep -iE 'x-node4-sticky|^[0-9.]+$'

Run it twice. The first run should show opened, the second held and the same address. A none on a request you believe is sticky means no session segment arrived, usually because the code building the username dropped it. A typo straight after the username does not produce none: in USERNAME-sesion-job42 the misspelled key stays part of the username, the credential no longer matches, and the gateway answers 407. After another segment it is read as part of that segment's value, so USERNAME-country-us-sesion-job42 asks for a country that does not exist and is refused with a 502. The rotating gateway takes the session ID up to the next recognized key; letters and digits are the safe choice, and the residential gateway requires them, up to 32 characters.

You do not have to type the segment by hand. The Connect card on the Proxies page in your dashboard has a Sticky session switch that builds the username and a New session button that mints another ID. The sticky vs rotating sessions guide walks through both gateways, and the proxy connection builder turns that username into ready-made Python, Node.js and curl snippets.

Why IP continuity matters to your workflow

A login, a pagination cursor and a follow-up form submission can share cookies while the target also checks the source address. Changing the exit mid-flow adds a variable that can end the target's session with no proxy error at all.

The opposite failure happens when independent workers share one session ID. They all inherit the same exit, so adding workers does not add addresses. Give each worker its own ID, and record the rotation mode next to your credentials and concurrency settings so the behavior is written down rather than buried in a connection string.

How to measure how long your proxy keeps its IP

Hold the session configuration constant for the whole test. Changing the session ID mid-test measures reassignment, not retention.

1. Record the settings before sending traffic

Write down the gateway, protocol, session ID, and whether the client opens a fresh connection or reuses one. Keep credentials out of logs.

Use one IP-check endpoint that returns the caller's address as plain text, and keep it for the whole test. Your normal target is only useful here if it actually exposes the observed source IP.

2. Send a timestamped request through the proxy

Set PROXY_URL to your proxy URL, including authentication, and IP_CHECK_URL to your chosen endpoint:

: "${PROXY_URL:?Set PROXY_URL using your provider's documented format}"
: "${IP_CHECK_URL:?Set IP_CHECK_URL to a plain-text IP-check endpoint}"

printf 'observed_at=%s exit=' "$(date -u +%FT%TZ)"
curl --silent --show-error --fail \
  --noproxy "" \
  --proxy "$PROXY_URL" \
  --url "$IP_CHECK_URL"
printf '\n'

The empty --noproxy value stops a bypass rule from excluding the check endpoint. Do not disable TLS verification to make a failed test pass; a certificate error is a separate problem from rotation. For credential syntax problems, follow the curl authenticated proxy requests workflow.

3. Repeat without changing anything

Each curl invocation is a separate process with a fresh connection, so repeated runs test continuity across connections. That does not tell you how a pooled client behaves; repeat the observation inside your real browser, crawler or HTTP client before treating it as production evidence.

Keep failed requests in the record. An error is not proof that the exit changed, and dropping errors hides the point where continuity broke.

4. Test the boundary

Compare observations before and after the 30-minute mark, counting from your first successful request, not your latest one. An earlier change points at session settings, an exit failure, or connectivity; check the X-Node4-Sticky value on the request where it changed.

Date the result. A test describes the configuration on that day, not every exit or future deployment.

How should your application handle session expiry?

Track a deadline from first assignment and stop starting work that cannot finish before it. Use a monotonic clock so a system-clock adjustment does not distort the calculation.

import time

STICKY_LIMIT_SECONDS = 30 * 60
SAFETY_MARGIN_SECONDS = 120  # tune to your slowest work unit

# Call right after the first successful request on this session ID.
first_success_observed_at = time.monotonic()
deadline = first_success_observed_at + STICKY_LIMIT_SECONDS - SAFETY_MARGIN_SECONDS


def can_start_work_unit(expected_seconds):
    return time.monotonic() + expected_seconds < deadline

This timer is an estimate of the gateway's timer, not a copy of it. The gateway starts its window when it assigns the exit, which happens before your client sees the response, and the client is never told the exact instant. The margin absorbs that gap. Do not schedule a login or a payment step for what you calculate to be the last seconds of the window, and remember the exit can still change earlier if it fails.

Keep the session ID, cookies and task checkpoint together. When the window ends, drain the current work unit, checkpoint, and continue under a new session ID where the workflow allows it. If you swap the exit but keep the cookies, the target sees its existing session arriving from a new address.

Does rotating an IP remove cookies or log you out?

Rotation does not clear your client's cookies. Cookies live in the client and routing lives in the proxy, but the target can still decide that a known cookie from a new address is suspicious and end the session. Reset browser state and proxy sessions deliberately, one at a time, rather than assuming one resets the other.

Can a rotating proxy give you the same IP again?

Yes. Rotation picks from a pool; it does not promise an unused address. If uniqueness matters to your job, log every observed exit and deduplicate on your side.