Stone.js API
    Preparing search index...

    Represents the core HTTP config options for the application. HTTP configuration options that are commonly used across adapters.

    interface HttpConfig {
        body: { defaultCharset: string; defaultType: string; limit: string };
        cache: Record<string, any>;
        cookie: { options: CookieOptions; secret?: string };
        cors: HttpCorsConfig;
        etag: { function?: (content: string, encoding: Encoding) => string };
        files: {
            defaultCompressionEncoding: Record<string, string>;
            download: Record<string, any>;
            extensions?: string[];
            rootDir?: string;
            upload: Record<string, any>;
        };
        hosts: {
            onlySubdomain: boolean;
            trusted: string[];
            trustedPattern: string[];
        };
        json: HttpJsonConfig;
        jsonp: { callback: { name: string } };
        limits: { maxCookies: number; maxHeaders: number };
        proxies: { trustedIp: string[]; untrustedIp: string[] };
        subdomain: { offset: number };
    }
    Index
    body: { defaultCharset: string; defaultType: string; limit: string }

    Configuration for request body parsing.

    Type Declaration

    • defaultCharset: string

      The default character set for the request body.

    • defaultType: string

      The content type of the request body.

    • limit: string

      The maximum size of the request body.

    cache: Record<string, any>

    Cache configuration options.

    cookie: { options: CookieOptions; secret?: string }

    Cookie-related configuration options.

    Type Declaration

    • options: CookieOptions

      Additional cookie options.

    • Optionalsecret?: string

      The secret used for signing cookies. Undefined by default: cookies are NOT signed unless a strong secret (>= 32 chars) is configured. A weak/empty secret is rejected rather than silently producing a forgeable signature.

    Cross-Origin Resource Sharing (CORS) configuration options.

    etag: { function?: (content: string, encoding: Encoding) => string }

    ETag-related configuration options.

    Type Declaration

    • Optionalfunction?: (content: string, encoding: Encoding) => string

      A custom function for generating ETags.

    files: {
        defaultCompressionEncoding: Record<string, string>;
        download: Record<string, any>;
        extensions?: string[];
        rootDir?: string;
        upload: Record<string, any>;
    }

    File upload and response configuration options.

    Type Declaration

    • defaultCompressionEncoding: Record<string, string>

      The default encoding for compressed static files.

    • download: Record<string, any>

      Configuration for file responses.

    • Optionalextensions?: string[]

      The list of accepted file extensions.

    • OptionalrootDir?: string

      The root directory for serving static files.

    • upload: Record<string, any>

      Configuration for file uploads.

    hosts: { onlySubdomain: boolean; trusted: string[]; trustedPattern: string[] }

    Host-related configuration options.

    Type Declaration

    • onlySubdomain: boolean

      Whether only subdomains are allowed.

    • trusted: string[]

      A list of trusted hostnames.

    • trustedPattern: string[]

      A list of trusted host patterns.

    JSON-related configuration options.

    jsonp: { callback: { name: string } }

    JSONP-related configuration options.

    Type Declaration

    • callback: { name: string }

      Configuration for the JSONP callback function.

      • name: string

        The name of the JSONP callback parameter.

    limits: { maxCookies: number; maxHeaders: number }

    Request limits — defence-in-depth against denial-of-service via oversized requests. Applied by RequestLimitsMiddleware (and effective across every adapter, incl. serverless where the Node server knobs are unavailable). Set a value to 0 to disable that check.

    Type Declaration

    • maxCookies: number

      Maximum number of cookies accepted in the request (0 = unlimited). Default 50.

    • maxHeaders: number

      Maximum number of distinct request headers accepted (0 = unlimited). Default 100.

    proxies: { trustedIp: string[]; untrustedIp: string[] }

    Proxy-related configuration options.

    Type Declaration

    • trustedIp: string[]

      A list of trusted proxies.

    • untrustedIp: string[]

      A list of untrusted proxies.

    subdomain: { offset: number }

    Subdomain-related configuration options.

    Type Declaration

    • offset: number

      The offset to use when determining subdomains.