The fundamental working principle of Rotating Proxy services is to maximize anonymity and diversity by returning a different IP address for each request. However, in some use cases, you may need to use the same IP address for a certain period. This is where the Sticky Session feature comes into play.
How Does Rotating Proxy Work?
In standard use with a Rotating Proxy system, each connection request is made through a different IP address. For example, when you select the United Kingdom (GB) location, your system connects by pulling random IP addresses from a large IP pool belonging to that country. Thanks to this mechanism:
- You appear with a different identity on each request
- You can bypass rate limiting on target platforms
- You minimize the risk of IP-based blocking
- Your likelihood of detection decreases in large-scale data collection operations
What is Sticky Session?
The Sticky Session feature is an advanced capability that allows you to use the same IP address for a certain period in your Rotating Proxy service. With this feature, you can create a "session" key to ensure that all your requests are made through the same IP address during the specified period.
Sticky Session Use Cases
The sticky session feature is particularly critical in the following situations:
- Login Operations: If your IP address changes while logging into a website, security systems may detect it as suspicious activity and lock your account
- Multi-Step Processes: Operations requiring multiple steps such as form filling, cart management, or payment processes require IP consistency
- Cookie and Session Management: The same IP is required when the target site uses cookie-based authentication
- API Rate Limiting: Some APIs impose request limits per IP; with sticky session, you maintain control of this limit
- Testing and Debugging: When you want to perform systematic tests over the same IP address
How to Create and Use Session Key?
To use sticky session, you need to configure your proxy connection information in a special format. The general usage format is as follows:
Username Format:
your_username-session-SESSION_KEY-country-COUNTRY_CODE
Example Configuration:
| Component | Description | Example |
|---|---|---|
| Username | Your account-specific username | user12345 |
| Session Key | Unique session identifier (any string you want) | mysession1, abc123, login_session |
| Country Code | Two-letter ISO country code | gb, us, tr, de |
| Proxy Address | Rotating proxy server address | rotate.livaproxy.com |
| Port | Proxy connection port | 12345 |
Complete Configuration Example:
Proxy Host: rotate.livaproxy.com
Proxy Port: 12345
Username: user12345-session-session1-country-gb
Password: your_account_password
How to Switch to a Different IP Address?
There are two basic methods to switch to a different IP address from the same country location:
Method 1: Changing Session Key
The most practical method is to change your session key. Each different session key assigns a different IP address:
- First Session:
user12345-session-session1-country-gb→ IP: 185.x.x.1 - Second Session:
user12345-session-session2-country-gb→ IP: 185.y.y.2 - Third Session:
user12345-session-session3-country-gb→ IP: 185.z.z.3
The values you can use as session keys are entirely up to you: numbers, letters, words, or combinations can be used.
Method 2: Normal Rotating Without Sticky Session
If you don't use the session parameter, the system automatically returns a different IP for each request:
Username: user12345-country-gb
Password: your_account_password
In this configuration, each HTTP request, each API call, or each browser connection uses a different IP address.
Multi-Session Management and Parallel Usage
One of the most powerful features of Rotating Proxy services is the ability to use multiple sessions simultaneously. This way:
- You can use different IPs for different accounts
- In multi-thread/worker configurations, you can assign a different IP to each thread
- In parallel scraping operations, each task can operate with a different identity
Multi-Session Example Configuration
| Task | Session Key | Country | Purpose |
|---|---|---|---|
| Thread 1 | session-worker1 | us | US data collection |
| Thread 2 | session-worker2 | gb | UK data collection |
| Thread 3 | session-worker3 | de | Germany data collection |
| Login Operation | session-account1 | tr | Account management |
Session Duration and IP Change Mechanism
When using sticky session, the IP address remains constant as long as your specified session key is active. However, IP changes may occur in some situations:
- Idle Time: If you don't make any requests for a certain period (typically 10-30 minutes), the session automatically expires
- IP Pool Rotation: When there are periodic refreshes in the IP pool, old IPs may become disabled
- Manual Session Change: When you change the session key, a new IP is assigned
Sticky Session Usage Example with Python
Using sticky session with Python and the requests library:
import requests
# Proxy configuration
proxy_host = "rotate.livaproxy.com"
proxy_port = "12345"
username = "user12345-session-mysession1-country-gb"
password = "your_password"
proxies = {
"http": f"http://{username}:{password}@{proxy_host}:{proxy_port}",
"https": f"http://{username}:{password}@{proxy_host}:{proxy_port}"
}
# Multiple requests with the same IP
for i in range(5):
response = requests.get("https://api.ipify.org", proxies=proxies)
print(f"Request {i+1} - IP: {response.text}")
In this example, all requests are made through the same IP address. You can get a new IP by changing the session key.
Difference Between Sticky Session and Normal Rotating
| Feature | Normal Rotating | Sticky Session |
|---|---|---|
| IP Change Frequency | Every request | Static for session duration |
| Use Case | Fast data collection, maximum anonymity | Login operations, multi-step processes |
| IP Control | System automatic | User-controlled (with session key) |
| Configuration | Simple | Session parameter required |
Common Issues and Solutions
I'm Getting Different IPs with the Same Session Key
If your IP is changing despite using the same session key:
- Too much time may be passing between requests (30+ minutes)
- Check the session format, there may be a typo
- Your proxy connection may be disconnecting and reconnecting
Session Key Not Working
If the session feature is not active:
- Make sure the username format is correct
- Check that hyphens (-) are used correctly
- Avoid using special characters in the session key (except hyphens and underscores)
Performance and Cost Optimization
Using sticky session helps you optimize your traffic in GB-based billing Rotating Proxy packages:
- Reduces Unnecessary Connection Overhead: TCP handshake and TLS negotiation are not repeated with each new IP
- Cookie and Cache Management: Working with the same IP allows you to benefit from target site cache mechanisms
- Error Rate Decreases: Connection drops due to IP changes are minimized
Summary and Recommendations
The sticky session feature in Rotating Proxy services is a powerful tool that provides flexibility and control. It's important to choose the right strategy based on your use case:
- For fast data collection: Prefer normal rotating without using session
- For login and session-required operations: Use sticky session
- For parallel operations: Assign a different session key to each thread
- To change IP: Change the session key or remove the session parameter
For detailed technical support, you can contact our 24/7 support team and get configuration recommendations for your specific use cases.