# Idle Timeout (Max Timeout)

Source: https://docs.evomi.com/proxy-instructions/residential-proxies/expert-settings/maxtimeout/

**Note:** Expert settings are only available for **Core Residential Proxies**.

Every tunnel through Evomi has an **idle timeout**. If no data passes through it in either direction for that long, Evomi closes the connection. The default is **45 seconds**.

Most scraping traffic never hits this limit. Long-lived connections can, though: streaming responses, slow LLM or inference calls, WebSockets, and HTTP/2 or gRPC connections that you keep open between requests. When the limit is hit, your client sees a plain TCP close (EOF) with no HTTP/2 `GOAWAY` and no error message.

The `_maxtimeout-` parameter changes this limit for a connection.

## How It Works

- The value is in **seconds**. Values from **5 to 300** are accepted.
- It measures **inactivity**, not total connection time. Each byte sent or received in either direction restarts the countdown, so an active connection can stay open well past the timeout.
- Values above 300 are reduced to **300**, and values below 5 are raised to **5**. If the value is not a whole number, the default of 45 seconds is used.
- **300 seconds (5 minutes) is the hard maximum.** No password setting gives you a longer idle timeout.
- The setting applies to HTTP `CONNECT` tunnels (HTTPS) and SOCKS5 TCP connections.

| Setting                       | Idle connection closes after |
|-------------------------------|------------------------------|
| *(no parameter)*              | 45 seconds                   |
| `_maxtimeout-120`             | 120 seconds                  |
| `_maxtimeout-300`             | 300 seconds (maximum)        |
| `_maxtimeout-900`             | 300 seconds (capped)         |
| `_maxtimeout-0`               | 5 seconds (minimum)          |

**`0` does not turn the timeout off**

Values outside the range are clamped, not ignored. `_maxtimeout-0` does **not** disable the timeout. It sets it to 5 seconds and will close idle connections very quickly.

## Usage

Append `_maxtimeout-<seconds>` to your proxy password:

<!--email_off-->
```bash
http://testuser:testpassword_maxtimeout-300@rp.evomi.com:1000
```
<!--email_on-->

## Implementation Examples

#### CURL

  ```bash
# HTTP CONNECT
curl -x http://rp.evomi.com:1000 -U testuser:testpassword_maxtimeout-300 https://ip.evomi.com/s

# SOCKS5
curl -x socks5h://rp.evomi.com:1002 -U testuser:testpassword_maxtimeout-300 https://ip.evomi.com/s
```

#### Python

  ```Python
import requests

proxy_pass = "testpassword_country-US_session-abc123_maxtimeout-300"
proxy_url = f"http://testuser:{proxy_pass}@rp.evomi.com:1000"

proxies = {
  "http": proxy_url,
  "https": proxy_url,
}
response = requests.get("https://ip.evomi.com/s", proxies=proxies, timeout=310)
print(response.text)
```

#### JavaScript

```JavaScript
const fetch = require('node-fetch');
const { HttpsProxyAgent } = require('https-proxy-agent');

const proxyPass = 'testpassword_maxtimeout-300';
const agent = new HttpsProxyAgent(`http://testuser:${proxyPass}@rp.evomi.com:1000`);

fetch('https://ip.evomi.com/s', { agent })
  .then(res => res.text())
  .then(body => console.log(body));
```

## Keeping Connections Open Longer Than 5 Minutes

Because the timeout only measures inactivity, you can keep a connection open for as long as you need by making sure that it is never idle for 300 seconds:

- **HTTP/2 / gRPC:** send an HTTP/2 `PING` frame at regular intervals, such as every 30–60 seconds. Most HTTP/2 and gRPC clients have a keepalive option that does this.
- **WebSockets:** send WebSocket ping frames at regular intervals.
- **Custom protocols:** send an application-level heartbeat.

**TCP keep-alive does not count**

TCP keep-alive probes have no payload, so the proxy does not see them as activity. The idle timer keeps running. Use a keepalive in the application protocol, as described above.

## Bandwidth Multiplier

Using `_maxtimeout-` adds a **1.2x** bandwidth multiplier, as other expert settings do. The multiplier applies whenever the parameter is present, whatever value you set. It adds to any other expert multipliers on the request, as explained in the [Expert Settings Overview](../). Enterprise customers may have custom multiplier values.

**Best For**
- LLM and AI inference calls that take more than 45 seconds to respond
- Long-polling and streaming (SSE) endpoints
- Persistent HTTP/2 and gRPC connections with gaps between requests
- WebSocket sessions with infrequent messages
