Documentation
    Preparing search index...

    Configuration options for HTTP request handling and processing

    type RequestConfig = {
        subdomainOffset: number;
        generateRequestId: boolean;
        createRequestId(): string;
        allowMethodSpoofing: boolean;
        getIp?: (request: any) => string;
        trustProxy: (address: string, distance: number) => boolean;
    }
    Index

    Properties

    subdomainOffset: number

    URL segments to ignore when extracting subdomains from a URL. Defaults to 2

    generateRequestId: boolean

    Enabling the flag will generated a unique request id from every HTTP request.

    The request id can be accessed using the "request.id()" method. Also, the value of x-request-id header is used as the id (if it exists).

    Defaults to false

    allowMethodSpoofing: boolean

    Method spoofing allows changing the request method using the query string. For example: Making a POST request on URL /users/1?_method=PATCH will be handled by the patch route.

    Defaults to false

    getIp?: (request: any) => string

    A custom implementation to get the request ip address

    trustProxy: (address: string, distance: number) => boolean

    A callback function to trust proxy ip addresses. You must use the proxy-addr package to compute this value.

    Defaults to: "proxyAddr.compile('loopback')"

    Methods

    • A custom method to generate a unique request id. Defaults to uuid v4.

      Returns string