> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zenrows.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Protocol and sticky sessions for Residential Proxies (Legacy)

> Learn how to choose between HTTP and HTTPS ports and configure sticky sessions with custom TTL values for Zenrows Residential Proxies.

Zenrows Residential Proxies support both HTTP and HTTPS protocols, each available on its own dedicated port, so you can connect with any HTTP client. You can also use sticky sessions (TTL) to control how long a particular IP address stays assigned to your requests, which is essential for maintaining session continuity in tasks like login persistence, checkout processes, or paginated data extraction.

## Choosing a Protocol: HTTP or HTTPS

Zenrows Residential Proxies expose two ports, one per protocol:

| Protocol | Port   | Proxy URL format                                                      |
| -------- | ------ | --------------------------------------------------------------------- |
| HTTP     | `1337` | `http://<YOUR_USERNAME>:<YOUR_PASSWORD>@superproxy.zenrows.com:1337`  |
| HTTPS    | `1338` | `https://<YOUR_USERNAME>:<YOUR_PASSWORD>@superproxy.zenrows.com:1338` |

<CodeGroup>
  ```bash HTTP theme={null}
  http://<YOUR_USERNAME>:<YOUR_PASSWORD>@superproxy.zenrows.com:1337
  ```

  ```bash HTTPS theme={null}
  https://<YOUR_USERNAME>:<YOUR_PASSWORD>@superproxy.zenrows.com:1338
  ```
</CodeGroup>

Replace `<YOUR_USERNAME>` and `<YOUR_PASSWORD>` with your credentials from the [Residential Proxies dashboard](https://app.zenrows.com/residential-proxies).

<Tip>
  Most HTTP clients, such as Python's `requests` or Node.js's `axios`, only need the HTTP port (`1337`) since they tunnel HTTPS traffic through it automatically. Use port `1338` only if your client or setup requires you to connect through a dedicated HTTPS proxy endpoint.
</Tip>

### Example: Using Both Ports

```python Python theme={null}
proxy_username = "YOUR_USERNAME"
proxy_password = "YOUR_PASSWORD"
proxy_domain = "superproxy.zenrows.com"

proxies = {
    "http": f"http://{proxy_username}:{proxy_password}@{proxy_domain}:1337",
    "https": f"https://{proxy_username}:{proxy_password}@{proxy_domain}:1338",
}

import requests
response = requests.get("https://www.scrapingcourse.com/ecommerce/", proxies=proxies)
print(response.status_code)
```

## Why Use Sticky TTL?

Sticky sessions allow you to:

* Maintain the same IP for a set period, from 30 seconds up to 1 day.
* Ensure session consistency for workflows that require login or multi-step navigation.
* Reduce the risk of bans or captchas by mimicking real user behavior.

## How to Enable Sticky Sessions

To enable sticky sessions, append the `ttl` parameter and a session ID to your proxy password in the proxy URL. This works the same way regardless of which port or protocol you use.

### Example: 30-Second Sticky Session

```bash theme={null}
http://<YOUR_USERNAME>:<YOUR_PASSWORD>_ttl-30s_session-1cLiFzDgsq36@superproxy.zenrows.com:1337
```

<Frame>
  <img src="https://static.zenrows.com/content/res_proxy_protocol_stickyttl_2aada7c68a.png" style={{ borderRadius: '0.5rem' }} alt="res_proxy_protocol_stickyttl" />
</Frame>

* `ttl-30s` ensures the IP will be retained for 30 seconds.
* `session-1cLiFzDgsq36` is a random session identifier that you can generate yourself. You can use any combination of letters and numbers, similar in length and style to the example. This allows Zenrows to allocate the same IP for multiple requests as long as you use the same session ID.

### Available Sticky TTL Values

* **30 seconds:** `ttl-30s`
* **1 minute:** `ttl-1m`
* **30 minutes:** `ttl-30m`
* **1 hour:** `ttl-1h`
* **1 day:** `ttl-1d`

<Info>
  The session ID is a random string that uniquely identifies your session. Generate it manually, or copy one from the Residential Proxy Dashboard.
</Info>

## Best Practices

* Use sticky sessions for login-required flows, shopping carts, or any scenario where the same IP is needed across requests.
* Choose the shortest TTL that meets your needs to maximize IP pool rotation and avoid detection.
* Always generate a unique session ID for each session to prevent conflicts.
* Match the port to the protocol you're connecting with (`1337` for HTTP, `1338` for HTTPS), unless your client tunnels both through the HTTP port.

## Troubleshooting

* If you observe frequent IP changes, double-check your TTL and session ID format.
* Some websites may require longer TTLs for certain workflows; experiment with different values to find the best fit.
* If your connection fails on port `1338`, confirm your client supports connecting directly to an HTTPS proxy endpoint, then fall back to port `1337`.

<Note>
  Learn more about session management and advanced proxy features in the [Zenrows Proxy documentation](/fetch/features/premium-proxy).
</Note>
