[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/core](../../README) / [index](../README) / ThrottleOptions

# Interface: ThrottleOptions

Defined in: [middleware/ThrottleMiddleware.ts:13](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/middleware/ThrottleMiddleware.ts#L13)

## Properties

### maxAttempts

> **maxAttempts**: `number`

Defined in: [middleware/ThrottleMiddleware.ts:15](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/middleware/ThrottleMiddleware.ts#L15)

Maximum number of requests allowed within the window.

***

### windowSeconds?

> `optional` **windowSeconds?**: `number`

Defined in: [middleware/ThrottleMiddleware.ts:17](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/middleware/ThrottleMiddleware.ts#L17)

Time window in seconds. Defaults to 60.

***

### keyResolver?

> `optional` **keyResolver?**: (`ctx`) => `string`

Defined in: [middleware/ThrottleMiddleware.ts:22](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/middleware/ThrottleMiddleware.ts#L22)

Custom key resolver — defaults to client IP address.
Use this to rate-limit by user ID, API key, route, etc.

#### Parameters

##### ctx

[`HttpContext`](../classes/HttpContext)

#### Returns

`string`

***

### trustedProxies?

> `optional` **trustedProxies?**: `number`

Defined in: [middleware/ThrottleMiddleware.ts:38](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/middleware/ThrottleMiddleware.ts#L38)

Number of trusted reverse proxies in front of this server.

`X-Forwarded-For` is client-writable, so it is only consulted when you state how many
proxies sit in front of the app — the count is what says which entry is not
attacker-controlled. Without it the unspoofable socket address is used.

- `undefined` (default) / `0` — no trusted proxy; key on the socket address
- `1` — one trusted proxy; the client IP is the second-to-last XFF entry
- `n` — the client IP is `n` entries from the right

#### Example

```ts
// Behind one load balancer:
ThrottleMiddleware.with({ maxAttempts: 60, trustedProxies: 1 })
```
