Interface WebApplicationOptions

Web Application Options

interface WebApplicationOptions {
    autoHandle404: boolean;
    autoHandleOptions: boolean;
    autoStartTunnel: boolean;
    backlog: number;
    bindHost: string;
    bindPort: number;
    bodyLimit: number;
    compression: boolean;
    corsDomain: string;
    enableContentSecurityPolicyHeader?: boolean;
    helmet?: HelmetOptions;
    recommendedHeaders?: boolean;
    requestLogging?: boolean | "full";
    ssl: boolean | "devcert";
    sslCertificate?: string | Buffer;
    sslHostnames?: string | string[];
    sslPrivateKey?: string | Buffer;
    websocketsOptions?: ServerOptions<typeof WebSocket, typeof IncomingMessage>;
}

Properties

autoHandle404: boolean

Whether we should auto handle 404s

Default

true
autoHandleOptions: boolean

Whether we should auto handle options

Default

true
autoStartTunnel: boolean

Auto start cloudflared?

backlog: number

TCP backlog for the underlying server

Default

511
bindHost: string

The host address to bind to

Default

0.0.0.0 (all)
bindPort: number

The bind port for the server

Default

440 if ssl, 80 if non-ssl
bodyLimit: number

Body size limit in Megabytes (MB)

compression: boolean

Whether compression should be enabled by default

Default

true
corsDomain: string

The CORS domain name to report in requests

Default

* (all)
enableContentSecurityPolicyHeader?: boolean

Whether we enable the content security policy header by default

Default

false
helmet?: HelmetOptions

Helmet module options

recommendedHeaders?: boolean

Whether we should return the default list of recommended headers with every request

Default

true
requestLogging?: boolean | "full"

Whether we should log requests to file/console

Default

false
ssl: boolean | "devcert"

Whether SSL should be enabled

Note: 'devcert' is only suitable for test systems as it will prompt to install a Root CA on the host for testing purposes only

Default

false
sslCertificate?: string | Buffer

The SSL certificate file and/or data.

Note: If a string is specified, a full path is expected

sslHostnames?: string | string[]

The SSL hostname(s) we should use when creating our devcert

Note: 'localhost' is always included

Default

<empty>
sslPrivateKey?: string | Buffer

The SSL private key file and/or data

Note: If a string is specified, a full path is expected

websocketsOptions?: ServerOptions<typeof WebSocket, typeof IncomingMessage>

WebSocket server options