# HttpProtect.(constructor) · @imqueue/http-protect

Source: https://imqueue.org/api/http-protect/latest/http-protect.httpprotect._constructor_/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/http-protect 3.0.1 — generated reference, not hand-written

Resolves every threshold, parses the exempt networks and connects to Redis.

**Signature:**

```typescript
constructor(options?: HttpProtectOptions | undefined);
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| options | [HttpProtectOptions](https://imqueue.org/api/http-protect/latest/http-protect.httpprotectoptions/) \| undefined | _(Optional)_ configuration; every field is optional, and omitting the object entirely gives default thresholds against `localhost:6379` |


## Exceptions

TypeError if any [HttpProtectOptions.safeNetworks](https://imqueue.org/api/http-protect/latest/http-protect.httpprotectoptions.safenetworks/) entry is not valid CIDR — including a bare address with no prefix length.

## Remarks

Connects immediately unless [HttpProtectOptions.redis](https://imqueue.org/api/http-protect/latest/http-protect.httpprotectoptions.redis/) is supplied, so this is not a cheap object to build in a process that has no Redis.

## Example


```typescript
const protect = new HttpProtect({
    redis: existingClient,
    ttl: 60,
    maxRequests: 600,
    banLimit: 10000,
    safeNetworks: ['10.0.0.0/8', '203.0.113.7/32'],
});
```

