Configuration Reference

Avalon uses TOML format configuration files. This document details all available configuration options.

Configuration Structure

[global]      # Global settings
[tls]         # TLS/HTTPS settings
[[servers]]   # Server configuration (array)

[global] Global Settings

OptionTypeDefaultDescription
log_levelstring"info"Log level: trace, debug, info, warn, error
admin_listenstring"localhost:2019"Admin API listen address
access_logstring-Access log file path
access_log_formatstring"common"Log format: common, json, combined

[global.compression] Compression Settings

OptionTypeDefaultDescription
enabledbooltrueEnable response compression
gzipbooltrueEnable gzip
brotlibooltrueEnable brotli
min_sizeint1024Minimum compression size (bytes)
levelint6Compression level (gzip: 1-9, brotli: 0-11)

[global.cache] Cache Settings

OptionTypeDefaultDescription
enabledboolfalseEnable response caching
default_ttlint300Default cache time (seconds)
max_entry_sizeint10485760Max single cache entry size (10MB)
max_cache_sizeint104857600Max total cache size (100MB)

[tls] TLS Settings

OptionTypeDefaultDescription
emailstring-ACME account email (required if ACME enabled)
acme_enabledbooltrueEnable ACME auto certificates
acme_castringLet's EncryptACME CA URL or provider name
storage_pathstring"./certs"Certificate storage directory
cert_pathstring-Manual certificate file path
key_pathstring-Manual private key file path

ACME CA options:

  • letsencrypt - Let's Encrypt (default)
  • le-staging - Let's Encrypt staging
  • zerossl - ZeroSSL
  • buypass - Buypass
  • google - Google Trust Services

[[servers]] Server Configuration

OptionTypeDefaultDescription
namestring"default"Server name (for logging)
listenarray-Listen addresses (required)
https_redirectboolfalseAuto redirect HTTP to HTTPS

Handler Types

reverse_proxy

[servers.routes.handle]
type = "reverse_proxy"
upstreams = ["127.0.0.1:3000", "127.0.0.1:3001"]
load_balancing = "round_robin"
timeout = 30

Load balancing strategies:

  • round_robin - Round robin
  • random - Random
  • least_conn - Least connections
  • ip_hash - IP hash
  • first - Always use first

file_server

[servers.routes.handle]
type = "file_server"
root = "/var/www/html"
browse = false
index = ["index.html", "index.htm"]
compress = true

static_response

[servers.routes.handle]
type = "static_response"
status = 200
body = "Hello, World!"

[servers.routes.handle.headers]
Content-Type = "text/plain"

redirect

[servers.routes.handle]
type = "redirect"
to = "https://example.com{uri}"
code = 301

Authentication

Basic Auth

[servers.routes.handle.auth]
realm = "Protected Area"

[[servers.routes.handle.auth.basic]]
username = "admin"
password = "password123"

API Key Auth

[[servers.routes.handle.auth.api_keys]]
key = "sk-xxxx"
name = "production"
source = "header"
param_name = "X-API-Key"

JWT Auth

[servers.routes.handle.auth.jwt]
secret = "your-secret-key"
algorithm = "HS256"
header = "Authorization"

CORS

[servers.routes.handle.cors]
allowed_origins = ["https://example.com"]
allowed_methods = ["GET", "POST", "PUT", "DELETE"]
allowed_headers = ["Content-Type", "Authorization"]
allow_credentials = true
max_age = 3600