Astro Node.js Fastify adapter
    Preparing search index...

    Interface ServerOptions

    Can be used to configure the server (Fastify).

    Note that the HTTPS environment variables are only read at runtime via environment variables. The HTTPS key can be set via the SERVER_KEY_PATH variable, and the certificate can be set via the SERVER_CERT_PATH variable.

    The server tries to read the HOST and PORT environment variables to configure the listen target. If the environment variable SERVER_SOCKET is set, it will take precedence over HOST and PORT. In the case, none of the above (HOST, PORT, SERVER_SOCKET) variables are present it will use the Astro server options.

    interface ServerOptions {
        accessLogging: boolean;
        compressionThreshold: number;
        connectionTimeout: number;
        disableAstroHtmlStreaming: boolean;
        disableOnDemandCompression: boolean;
        enableAstroResponseBuffering: boolean;
        gracefulTimeout: number;
        http2: boolean;
        keepAliveTimeout: number;
        logLevel: LogLevel;
        requestIdHeader: string | false;
        trustProxy: TrustedProxy;
    }
    Index

    Properties

    accessLogging: boolean

    Enables or disables request logging.

    Environment variable: SERVER_ACCESS_LOGGING

    Environment value: "1" (true), "0" (false)

    true
    
    compressionThreshold: number

    Defines the compression threshold in bytes. If the response size is smaller than this threshold, it will not be compressed. (As long as the response isn't a streaming response.)

    Environment variable: SERVER_COMPRESSION_THRESHOLD

    Environment value:

    10240
    
    connectionTimeout: number

    Defines the server timeout in milliseconds. See the Node.js documentation for more details: https://nodejs.org/api/http.html#http_server_timeout

    Environment variable: SERVER_CONNECTION_TIMEOUT

    Environment value:

    0
    
    disableAstroHtmlStreaming: boolean

    Disables Astro's experimental HTML streaming feature.

    Environment variable: SERVER_DISABLE_ASTRO_HTML_STREAMING

    Environment value: "1" (true), "0" (false)

    false
    
    disableOnDemandCompression: boolean

    Disables on-demand compression for all responses handled by Fastify.

    Using this option will not globally disable compression, since your implementation can still reply with compressed responses. This can be useful if the service is deployed behind a reverse proxy which handles compression but requires the Content-Length header.

    Environment variable: SERVER_DISABLE_ON_DEMAND_COMPRESSION

    Environment value: "1" (true), "0" (false)

    false
    
    enableAstroResponseBuffering: boolean

    Buffers all responses returned by Astro. But since they're passed to Fastify, they can still be compressed and therefore converted to streaming responses.

    This can be useful if the service is deployed behind a reverse proxy which handles compression but requires the Content-Length header.

    Environment variable: SERVER_ENABLE_ASTRO_RESPONSE_BUFFERING

    Environment value: "1" (true), "0" (false)

    false
    
    gracefulTimeout: number

    The time in milliseconds to wait for the server to gracefully close before forcefully shutting down.

    Environment variable: SERVER_GRACEFUL_TIMEOUT

    Environment value:

    5000
    
    http2: boolean

    If true an HTTP/2 server will be created instead of the HTTP/1.1 one.

    Environment variable: SERVER_HTTP2

    Environment value: "1" (true), "0" (false)

    false
    
    keepAliveTimeout: number

    Defines the server keep-alive timeout in milliseconds. See the Node.js documentation for more details: https://nodejs.org/api/http.html#http_server_keepalivetimeout

    Environment variable: SERVER_KEEP_ALIVE_TIMEOUT

    Environment value:

    72000
    
    logLevel: LogLevel

    Defines the log level the server should use. Note that this only affects the server, not Astro itself.

    Environment variable: SERVER_LOG_LEVEL

    Environment value: LogLevel

    info
    
    requestIdHeader: string | false

    The header name that should be used to set the request ID. For more details see Fastify's documentation: https://fastify.dev/docs/latest/Reference/Logging/#logging-request-id

    Environment variable: SERVER_REQUEST_ID_HEADER

    Environment value:

    "request-id"
    
    trustProxy: TrustedProxy

    Lets the server know that it is behind a proxy and should trust the "X-Forwarded-*" headers. For more details see Fastify's documentation: https://fastify.dev/docs/latest/Reference/Server/#trustproxy

    Environment variable: SERVER_TRUST_PROXY

    Environment value: "1" (true), "0" (false),