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

# Rotating proxies and sticky sessions: setup and testing

> Choose per-request rotation or sticky sessions, preserve generated proxy credentials, and test exit IP behavior with curl on Windows, macOS, or Linux.

The gateway can remain unchanged while the session policy changes the exit. Select the persistence your task needs before generating credentials. [Source: MiyaIP rotation guide](https://miyaip.com/blog/rotating-proxy).

## Choose a mode

| Mode | Exit behavior | What to verify |
| - | - | - |
| **Rotate every request** | Selects exits under the product's request rules | Repeated IPs in a small sample do not describe the entire pool |
| **Sticky Session** | Requests continuity within a chosen window | Duration, consistent session fields, and interruption behavior |
| **Manual API switch** | Changes assignments through a supported operation | Product availability and its specific instructions |
| Static proxy | Uses a longer-lived assigned address | Expiry, renewal, and replacement rules |

The dynamic generator defaults to a **30-minute** sticky session. Current choices are **5, 10, 15, and 30 minutes**. Supported dynamic residential and mobile products offer manual switching. Unlimited residential currently offers per-request rotation and sticky sessions without Manual API switch. Follow the current dashboard and plan's rules.

A session timer does not preserve application logins or guarantee that the exit stays available throughout the window.

## Configure and record

<Steps>
  <Step title="Select the product and policy">
    Open the [dynamic residential](/proxy/dynamic-residential/quick-start), [mobile](/proxy/mobile/quick-start), or [unlimited residential](/proxy/unlimited-residential/quick-start) setup. Check **Rotation mode**, then choose **Duration**.

    For Manual API switch, use the instructions and interface provided for that mode. Do not guess a switching URL or borrow another provider's interface.
  </Step>

  <Step title="Keep the conditions fixed">
    Choose the exit location, gateway, and protocol. Copy the generated host, port, username, and password. Record the policy, duration, location, and timestamp.

    Reuse the same generated fields when testing stickiness. Start a new series after regenerating credentials or changing session settings.
  </Step>

  <Step title="Observe sequential requests">
    Run the command matching your platform and protocol below. Send a small sequential series and record the returned IP, timestamp, and completion. Then test your actual application.

    Test rotation and stickiness separately. Avoid changing location, gateway, and protocol together in one comparison.
  </Step>

  <Step title="Investigate unexpected results">
    Check whether the request actually used the proxy, authentication succeeded, and the credentials match the selected policy. Preserve timeout or interruption errors, then reconnect according to the product's current rules.

    Interpret repeated IPs alongside session settings and connection reuse. An IP-reporting service describes that request's exit; verify your actual application as well.
  </Step>
</Steps>

## Verify the session

Replace every uppercase placeholder with your dashboard's generated values. These requests use [ipify's public API](https://www.ipify.org/). An HTTP proxy can carry a request to an HTTPS destination; the proxy protocol and destination scheme are separate.

### macOS or Linux: HTTP

```bash theme={null}
curl --proxy 'http://PROXY_HOST:PROXY_PORT' --proxy-user 'PROXY_USERNAME:PROXY_PASSWORD' --noproxy '' --connect-timeout 10 --max-time 30 --url 'https://api.ipify.org?format=json'
printf 'curl_exit=%s\n' "$?"
```

### macOS or Linux: SOCKS5

```bash theme={null}
curl --proxy 'socks5h://PROXY_HOST:PROXY_PORT' --proxy-user 'PROXY_USERNAME:PROXY_PASSWORD' --noproxy '' --connect-timeout 10 --max-time 30 --url 'https://api.ipify.org?format=json'
printf 'curl_exit=%s\n' "$?"
```

### Windows PowerShell

```powershell theme={null}
$sessionProxy = 'http://PROXY_HOST:PROXY_PORT'
# For SOCKS5, use 'socks5h://PROXY_HOST:PROXY_PORT'
$sessionPreviousNoProxy = $env:NO_PROXY
try {
  $env:NO_PROXY = ''
  curl.exe --proxy $sessionProxy --proxy-user 'PROXY_USERNAME:PROXY_PASSWORD' --connect-timeout 10 --max-time 30 --url 'https://api.ipify.org?format=json'
  "curl_exit=$LASTEXITCODE"
} finally {
  $env:NO_PROXY = $sessionPreviousNoProxy
}
```

Use `curl.exe` to avoid PowerShell's `curl` alias. The example temporarily clears `NO_PROXY` and restores it afterward, preventing an exclusion from bypassing the proxy without relying on empty native arguments in older PowerShell versions.

`socks5h://` resolves the destination hostname through the proxy; `socks5://` resolves it locally. The connection timeout is 10 seconds and total timeout is 30 seconds. These command timeouts are separate from the product's session duration. See the [curl manual](https://curl.se/docs/manpage.html).

After checking exits, follow the [latency test](/guides/latency) to record request results. Remove real usernames and passwords from shared records.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.