ServerConfig Type — astro Architecture
Architecture documentation for the ServerConfig type/interface in config.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 4db68d7e_198d_0a3b_610d_ad7facaf390d["ServerConfig"] 9a410621_7e4c_298f_fae4_ea2f60c8b25d["config.ts"] 4db68d7e_198d_0a3b_610d_ad7facaf390d -->|defined in| 9a410621_7e4c_298f_fae4_ea2f60c8b25d style 4db68d7e_198d_0a3b_610d_ad7facaf390d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/types/public/config.ts lines 66–138
export type ServerConfig = {
/**
* @name server.host
* @type {string | boolean}
* @default `false`
* @version 0.24.0
* @description
* Set which network IP addresses the dev server should listen on (i.e. non-localhost IPs).
* - `false` - do not expose on a network IP address
* - `true` - listen on all addresses, including LAN and public addresses
* - `[custom-address]` - expose on a network IP address at `[custom-address]`
*/
host?: string | boolean;
/**
* @name server.port
* @type {number}
* @default `4321`
* @description
* Set which port the dev server should listen on.
*
* If the given port is already in use, Astro will automatically try the next available port.
*/
port?: number;
/**
* @name server.allowedHosts
* @type {string[] | true}
* @default `[]`
* @version 5.4.0
* @description
*
* A list of hostnames that Astro is allowed to respond to. When the value is set to `true`, any
* hostname is allowed.
*
* ```js
* {
* server: {
* allowedHosts: ['staging.example.com', 'qa.example.com']
* }
* }
* ```
*/
allowedHosts?: string[] | true;
/**
* @name server.headers
* @typeraw {OutgoingHttpHeaders}
* @default `{}`
* @version 1.7.0
* @description
* Set custom HTTP response headers to be sent in `astro dev` and `astro preview`.
*/
headers?: OutgoingHttpHeaders;
/**
* @name server.open
* @type {string | boolean}
* @default `false`
* @version 4.1.0
* @description
* Controls whether the dev server should open in your browser window on startup.
*
* Pass a full URL string (e.g. "http://example.com") or a pathname (e.g. "/about") to specify the URL to open.
*
* ```js
* {
* server: { open: "/about" }
* }
* ```
*/
open?: string | boolean;
};
Defined In
Source
Frequently Asked Questions
What is the ServerConfig type?
ServerConfig is a type/interface in the astro codebase, defined in packages/astro/src/types/public/config.ts.
Where is ServerConfig defined?
ServerConfig is defined in packages/astro/src/types/public/config.ts at line 66.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free