Session Control & IP Rotation
Learn how to manage Residential Proxy sessions to keep the same IP address across multiple requests and control session length and IP rotation.
Oxylabs Residential Proxies rotate automatically with every request by default. To keep the same IP address for sequential requests, configure sticky session parameters in your username string or connect via sticky proxy entry ports.
sessid
Automatically rotates to a new IP to keep the session active. 10 minutes (default).
sesstime
Extends sessid lifetime. Session ends once the timer expires. Up to 1440 min (24 hrs)
sessid_oneip
Binds strictly to a single exit node. Fails with HTTP 502 if IP drops. Up to 1440 min (24 hrs)
Port range
Port-based stickiness (ports 10001–49999) requires no username-based parameters. Up to 10 minutes.
Default sticky sessions (sessid)
The sessid parameter routes multiple requests through the same IP address as long as the IP is online. Add sessid after your username with a random alphanumeric string (e.g. sessid-abcd1234):
customer-USERNAME-cc-DE-sessid-abcd1234:PASSWORDBy default, a session lasts 10 minutes, or ends after 60 seconds without any requests – whichever comes first. Once that happens, a new IP address is assigned automatically so your requests continue uninterrupted. To change the session length, please refer to Extend session duration.
Code examples
curl -x pr.oxylabs.io:7777 -U "customer-USERNAME-cc-DE-sessid-abcd1234:PASSWORD" https://ip.oxylabs.io/location<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$country = 'DE';
$session = mt_rand();
$proxy = 'pr.oxylabs.io:7777';
$query = curl_init('https://ip.oxylabs.io/location');
curl_setopt($query, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($query, CURLOPT_PROXY, "http://$proxy");
curl_setopt($query, CURLOPT_PROXYUSERPWD, "customer-$username-cc-$country-sessid-$session:$password");
$output = curl_exec($query);
curl_close($query);
if ($output)
echo $output;
?>import urllib.request
import random
username = 'USERNAME'
password = 'PASSWORD'
country = 'DE'
session = random.random()
entry = ('http://customer-%s-cc-%s-sessid-%s:%s@pr.oxylabs.io:7777' %
(username, country, session, password))
query = urllib.request.ProxyHandler({
'http': entry,
'https': entry,
})
execute = urllib.request.build_opener(query)
print(execute.open('https://ip.oxylabs.io/location').read())Extend session duration (sesstime)
Combine the sesstime parameter with sessid to extend session duration beyond the 10-minute default (or up to 60 seconds of inactivity) up to 1440 minutes (24 hours). Specify duration in minutes (e.g., sesstime-30 for 30 minutes):
customer-USERNAME-cc-DE-sessid-abcd1234-sesstime-30:PASSWORDBecause residential proxy IP availability is dynamic, an individual exit node may disconnect before your specified session time expires. If an exit node drops, sessid will automatically rotate to a new IP to fulfill your request.
Code examples
We chose the same German IP as in the previous example, this time we are adding sessid string and sesstime parameter for 7 minutes:
Single-IP session binding (sessid_oneip)
Use sessid_oneip instead of sessid when your workflow requires strict IP consistency and cannot tolerate IP rotation mid-session.
Unlike standard sticky sessions, if the assigned exit node goes offline, the system will not rotate to a new IP, and instead the request fails with an HTTP 502 Bad Gateway error. When a 502 occurs, initiate a new session using a fresh sessid_oneip string. sessid_oneip can be combined with sesstime in the same way as sessid.
Code examples
Sticky proxy entry nodes (Port range)
Connect to country-specific entry node points on dedicated port ranges (10001–49999) to maintain an IP address for up to 10 minutes without passing sessid parameters in your username string. Reusing the same port keeps the same exit node, while changing the port assigns a new sticky IP.
See the Oxylabs dashboard for entry point information, download a complete list of sticky entry points, or see them in the table below.
Code examples
Last updated
Was this helpful?