Sticky Sessions & Manual Rotation
What Are Sticky Sessions?
When you use the proxy rotator normally, each request may exit through a different proxy IP. This is called rotation - your traffic appears to come from different locations.
Sticky sessions let you "stick" to the same exit IP across multiple requests. Think of it like reserving a specific proxy just for your session.
Normal rotation (default):
Request 1 → Proxy A → Exit IP: 1.2.3.4
Request 2 → Proxy C → Exit IP: 5.6.7.8
Request 3 → Proxy B → Exit IP: 9.10.11.12
With sticky session:
Request 1 → Proxy A → Exit IP: 1.2.3.4
Request 2 → Proxy A → Exit IP: 1.2.3.4 ← same IP
Request 3 → Proxy A → Exit IP: 1.2.3.4 ← same IP
When Do You Need Sticky Sessions?
- Login sessions - Websites that check if your IP changes mid-session
- Multi-step workflows - Shopping carts, form submissions, checkout flows
- API rate limits - When you need consistent identity for rate limit tracking
- Scraping sequences - When you need to maintain state across page navigations
How to Use Sticky Sessions
Option 1: Add a Session ID to Your Username
Simply add -session- followed by any identifier to your username:
# Format: username-session-YOURID:password # Example: Create a session called "mysession" curl -x "john-session-mysession:password123@cld-us-xxxx.tp-ns.com:80" https://checkip.amazonaws.com # Every request with "john-session-mysession" uses the same exit IP curl -x "john-session-mysession:password123@cld-us-xxxx.tp-ns.com:80" https://checkip.amazonaws.com curl -x "john-session-mysession:password123@cld-us-xxxx.tp-ns.com:80" https://checkip.amazonaws.com
Option 2: Use the X-Proxy-Session Header
If you can't modify your username, use a header instead:
curl -x "john:password123@cld-us-xxxx.tp-ns.com:80" \ --proxy-header "X-Proxy-Session: mysession" \ https://checkip.amazonaws.com
This also works with IP-based authentication (no username needed):
curl -x "cld-us-xxxx.tp-ns.com:80" \ --proxy-header "X-Proxy-Session: mysession" \ https://checkip.amazonaws.com
What Is Manual Rotation?
Manual rotation means you control when to get a new IP, rather than getting a random one each request.
With sticky sessions, you keep the same IP until you decide to change it. To rotate (get a new IP), simply use a different session ID:
# Session "v1" - assigned to Proxy A (1.2.3.4) curl -x "john-session-task1-v1:pass@cld-us-xxxx.tp-ns.com:80" https://checkip.amazonaws.com # Output: 1.2.3.4 # Still using "v1" - same IP curl -x "john-session-task1-v1:pass@cld-us-xxxx.tp-ns.com:80" https://checkip.amazonaws.com # Output: 1.2.3.4 # NOW ROTATE: Switch to "v2" - gets assigned to different proxy curl -x "john-session-task1-v2:pass@cld-us-xxxx.tp-ns.com:80" https://checkip.amazonaws.com # Output: 5.6.7.8 ← new IP!
💡 Key insight: The session ID is just a string you control. Change the string, get a new IP assignment.
Session Expiration
Sessions automatically expire after 24 hours of inactivity.
- Inactivity means no requests using that session ID
- Each request resets the 24-hour timer
- Active sessions never expire
10:00 - Create session "mysession" (expires tomorrow at 10:00) 14:00 - Make a request (timer resets, now expires tomorrow at 14:00) 14:01 - Make another request (timer resets again) ... If you stop making requests for 24 hours → session expires
Keeping Sessions Alive
If you need a session to last longer than 24 hours, just make periodic requests:
# Simple keepalive - run every few hours curl -x "john-session-mysession:pass@cld-us-xxxx.tp-ns.com:80" -s https://checkip.amazonaws.com > /dev/null
Quick Reference
| Task | How to Do It |
|---|---|
| Create a sticky session | Add -session-YOURID to username |
| Keep the same IP | Use the same session ID |
| Get a new IP (rotate) | Use a different session ID |
| Keep session alive | Make requests within 24 hours |
Examples
Python
import requests PROXY = "http://john-session-mysession:password123@cld-us-xxxx.tp-ns.com:80" # All requests use the same exit IP for i in range(5): response = requests.get("https://checkip.amazonaws.com", proxies={"http": PROXY, "https": PROXY}) print(f"Request {i+1}: {response.text}")
Node.js
const axios = require("axios"); const HttpsProxyAgent = require("https-proxy-agent"); const agent = new HttpsProxyAgent( "http://john-session-mysession:password123@cld-us-xxxx.tp-ns.com:80" ); // All requests use the same exit IP for (let i = 0; i < 5; i++) { const response = await axios.get("https://checkip.amazonaws.com", { httpsAgent: agent, }); console.log(`Request ${i + 1}: ${response.data}`); }
Manual Rotation Example
import requests def get_proxy(session_id): return f"http://john-session-{session_id}:password123@cld-us-xxxx.tp-ns.com:80" # Use session v1 proxy_v1 = get_proxy("task-v1") print(requests.get("https://checkip.amazonaws.com", proxies={"http": proxy_v1, "https": proxy_v1}).text) # Output: 1.2.3.4 # Rotate to v2 when needed proxy_v2 = get_proxy("task-v2") print(requests.get("https://checkip.amazonaws.com", proxies={"http": proxy_v2, "https": proxy_v2}).text) # Output: 5.6.7.8
Common Questions
Q: How many sticky sessions can I have?
A: Unlimited. Create as many session IDs as you need.
Q: What if my assigned proxy goes down?
A: The proxy rotator automatically assigns you a new healthy proxy. Your session continues working, just with a different IP.
Q: Do sessions survive proxy server restarts?
A: No. Sessions are stored in memory on the rotating proxy server. In the rare event of a server restart, your next request will automatically get a new proxy assignment.
Q: Can I choose which specific IP I get?
A: No. The proxy rotator assigns a proxy from the pool automatically. You control when to rotate, not which IP you get.