@sigiljs/sigil
Version:
TypeScript-first Node.js HTTP framework offering schema-driven routing, modifier-based middleware, plugin extensibility, and flexible response templating
15 lines (14 loc) • 494 B
TypeScript
import { IncomingMessage } from 'http';
/**
* Derives the request host from the most‐trusted available header.
*
* Order:
* 1. Forwarded: host=<value> (RFC 7239, only if trustProxy)
* 2. X-Forwarded-Host (only if trustProxy)
* 3. Host (always)
*
* @param req IncomingMessage
* @param trustProxy whether to trust proxy headers
* @returns the host (including port if present), or null
*/
export declare function deriveHost(req: IncomingMessage, trustProxy?: boolean): string | null;