Skip to content
Ali Bazregar edited this page Jun 27, 2024 · 1 revision

General Structure of Config File

Lazy The web server processes client requests via services defined in the settings file. This property controls the loading sequence of these services. If set to false, all services are loaded when the web server starts. If set to true, services are loaded only when requested via their respective endpoints, optimizing server startup speed and resource allocation. Default value is false.

Endpoints This property contains a list of key-value pairs where the key represents the endpoint name and the value contains settings specific to that endpoint. Each value is of type HostEndPointOptions.

Services This property contains an array of HostServiceOptions, each defining settings for a host.

HostEndPointOptions

Defines settings for an endpoint with the following properties:

  • Type: Either WebSocket or http, indicating the communication protocol with the client.
  • Addresses: Lists IP addresses and ports managed by this endpoint, along with their configurations. Each item is of type PortListenerOptions.
  • MaxHeaderSize: Specifies the maximum allowed size for headers in requests managed by this endpoint. Default value is 1024.
  • Active: Specifies if the endpoint is active (true) or inactive (false).
  • DefaultHost: Sets the default host property for all incoming requests. Used specifically in development environments where subsequent parts rely on a specific domain while the service runs on a high IP.

Routing

Specifies which service should process a request and generate output. This property can be a string referring to the respective service name or a list of conditions. This list is of type ServiceSelectorPredicateOptions.

  • ReadHeaderTimeOut: Specifies the timeout period for reading headers in requests. Default is 5 seconds.

PortListenerOptions

Specifies the settings for an IP and port associated with an endpoint, including:

  • EndPoint: A string consisting of IP and port to which the endpoint listens for requests.
  • Certificate: Contains certificate settings, accepting one of two object types based on the type property value: SslCertificateOptions or SniCertificateOptions.
  • ConnectionIdleTime: Applies only to connections or HTTP2 protocols, specifying when an internal connection should close.

SslCertificateOptions

Defines SSL certificate settings for a specific site with the following properties:

  • IgnoreValidationError: Only applicable in dev mode. When enabled (true), SSL errors are ignored. Default is false.
  • Http2: Boolean value indicating whether requests with HTTP2 protocol are accepted by this endpoint. Default is false.
  • http11: Boolean value indicating whether requests with HTTP1.1 protocol are accepted by this endpoint. Default is true.
  • Protocol: Specifies the SSL protocol type. Default is none.

SniCertificateOptions

Defines SSL certificate settings for a specific set of sites with the following properties:

  • IgnoreValidationError: Only applicable in dev mode. When enabled (true), SSL errors are ignored. Default is false.
  • Http2: Boolean value indicating whether requests with HTTP2 protocol are accepted by this endpoint. Default is false.
  • http11: Boolean value indicating whether requests with HTTP1.1 protocol are accepted by this endpoint. Default is true.
  • Protocol: Specifies the SSL protocol type. Default is none.
  • Hosts: Specifies the list of hosts handled by SNI, including a list of HostCertificateOptions.

HostCertificateOptions

Specifies certificate information for a host, including:

  • HostNames: An array of host names associated with SSL.
  • FilePath: Specifies the path to the PFX certificate file.
  • Password: Specifies the password for the PFX file.
  • KeyFilePath: Specifies the path to the key file.

ServiceSelectorPredicateOptions

Specifies predicates for selecting the appropriate service to handle requests, including:

  • Async: If true, all predicates are evaluated simultaneously, and the first valid predicate is selected. If false, predicates are evaluated sequentially. Priority is given from top to bottom.
  • Items: Contains a list of predicates, each of type ServiceSelectorPredicateItemOptions.

ServiceSelectorPredicateItemOptions

Contains conditions for selecting a specific service, including:

  • Service: Specifies the service name to select if all conditions are met.
  • Methode: Can be a string or an array of strings specifying acceptable methods in web requests, such as post, get, delete, etc.
  • Url: A string capable of using Regex expressions to specify matching URLs.
  • Cookie: Specifies one or more cookie keys expected in the web request.
  • MultiPart: Boolean indicating whether the request should be multipart (true) or not (false).
  • ClientIP: Specifies the client's IP address.
  • Field: Specifies one or more field names in the web request header.

HostServiceOptions

Specifies settings for a service responsible for handling requests and converting them to output, including:

  • Type: Specifies the type of service, such as File, Sql
  • ReadBodyTimeOut: Specifies the maximum time allowed for reading the request body. Default is 15 seconds.
  • ProcessTimeOut: Specifies the maximum time allowed for processing the request. Default is 30 seconds.
  • MaxBodySize: Specifies the maximum size of the request body. Default is 1024 bytes.
  • MaxMultiPartSize: Specifies the maximum size of multipart bodies. Default is 2048 bytes.
  • Multipart: Settings related to managing multipart requests, of type MultipartOptions.
  • Settings: Lists settings in key-value pairs used.