Skip to content

Cerces


Cerces / middleware/trusted-host / createTrustedHostMiddleware

Function: createTrustedHostMiddleware()

createTrustedHostMiddleware(allowedHosts): Middleware

Defined in: src/middleware/trusted-host.ts:21

Creates a middleware that restricts access based on the "Host" header of incoming requests. It checks if the host matches any of the allowed host patterns.

Parameters

allowedHosts

[string, ...string[]]

An array of allowed host patterns. Patterns can include wildcards (*).

Returns

Middleware

A Middleware instance that enforces the trusted host policy.