Configuration Reference¶
The server can be configured using a TOML file passed to the Server constructor.
Section: [ports]¶
server_port: The primary port the server listens on (default: 443).http_redirection_port: The port used for plain HTTP traffic if redirection is enabled (default: 80).
Section: [https]¶
enable_https: Boolean to enable/disable TLS (requires certificates).cert_file: Path to the PEM-encoded SSL certificate.key_file: Path to the PEM-encoded private key.enable_http_redirection: If true, traffic on the HTTP port is redirected to HTTPS.
Section: [idle-ip-cleanup]¶
interval_seconds: Time in seconds between background cleanup tasks (default: 600).idle_timeout_seconds: How long a client IP must be inactive before its records are removed (default: 300).
Section: [network]¶
client_timeout_seconds: Socket read timeout for client connections (default: 5).default_http_redirection_port: The fallback port used for redirects if not otherwise specified.recv_buffer_size: The size in bytes for the socket receive buffer (default: 4096).
Section: [threading]¶
min_threads: Minimum number of worker threads in the pool (default: 4).max_threads: Maximum number of worker threads in the pool (default: 32).max_queue_size: Maximum number of pending tasks before rejecting new connections (default: 1024).
Section: [rate-limits]¶
max_connections_per_ip: Maximum concurrent connections allowed from a single client IP (default: 10).max_keep_alive_requests: Maximum requests allowed per persistent connection (default: 100).max_tokens/refill_rate: Parameters for the token-bucket algorithm used for rate limiting.
Section: [http-config]¶
max_header_bytes: Maximum allowed size for HTTP headers (default: 16KB).max_header_count: Maximum number of headers allowed per request (default: 100).max_total_header_size: Maximum total size for all headers combined (default: 64KB).max_body_bytes: Maximum allowed size for the HTTP request body (default: 10MB).allowed_methods: List of HTTP methods processed by the server (e.g., [“GET”, “POST”]).allowed_versions: List of supported HTTP protocol versions (e.g., [“HTTP/1.0”, “HTTP/1.1”]).
Section: [logging]¶
log_level: Severity filter level (INFO, WARN, ERROR).file_logging_enabled: Whether to enable logging to a specific file on disk.file_logging_path: Path to the log file. If the directories do not exist, they will be created.