> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ultrabalancer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# File Config Reference

> Complete YAML and TOML configuration reference

## YAML Format

```yaml theme={null}
listen_address: "0.0.0.0"
listen_port: 8080
algorithm: "round-robin"
workers: "auto"
max_connections: 10000

backends:
  - host: "192.168.1.10"
    port: 8080
    weight: 100
    max_connections: 1000
  - host: "192.168.1.11"
    port: 8080
    weight: 150
    max_connections: 1500
```

## TOML Format

```toml theme={null}
listen_address = "0.0.0.0"
listen_port = 8080
algorithm = "round-robin"
workers = "auto"
max_connections = 10000

[[backends]]
host = "192.168.1.10"
port = 8080
weight = 100

[[backends]]
host = "192.168.1.11"
port = 8080
weight = 150
```

## All Options

### Listener

| Option            | Type       | Default     |
| ----------------- | ---------- | ----------- |
| `listen_address`  | string     | `"0.0.0.0"` |
| `listen_port`     | integer    | `8080`      |
| `workers`         | string/int | `"auto"`    |
| `max_connections` | integer    | `10000`     |

### Algorithm

| Option      | Type   | Default         |
| ----------- | ------ | --------------- |
| `algorithm` | string | `"round-robin"` |

Options: `round-robin`, `least-connections`, `ip-hash`, `random`, `weighted`, `power-of-two`, `fastest-response`

### Backends

| Option            | Type    | Default  |
| ----------------- | ------- | -------- |
| `host`            | string  | required |
| `port`            | integer | required |
| `weight`          | integer | `100`    |
| `max_connections` | integer | `1000`   |

### Health Check

```yaml theme={null}
health_check:
  enabled: true
  interval_ms: 5000
  timeout_ms: 2000
  max_failures: 3
  path: "/health"
```

### Circuit Breaker

```yaml theme={null}
health_check:
  circuit_breaker:
    enabled: true
    failure_threshold: 5
    success_threshold: 2
    timeout_seconds: 60
```

### Caching

```yaml theme={null}
cache:
  enabled: true
  max_size: 10000
  default_ttl_seconds: 300
```

### Compression

```yaml theme={null}
compression:
  enabled: true
  algorithm: "gzip"  # gzip, brotli, zstd
  min_size: 1024
```

### Rate Limiting

```yaml theme={null}
rate_limit:
  enabled: true
  requests_per_second: 10000
  per_ip_rps: 100
  burst: 50
```

### IP Filtering

```yaml theme={null}
ip_filter:
  whitelist:
    - "10.0.0.0/8"
  blacklist:
    - "192.168.1.100"
```

### Sticky Sessions

```yaml theme={null}
sticky_sessions:
  enabled: true
  cookie_name: "ULTRABALANCER_SESSION"
  ttl_seconds: 3600
```

### Retry

```yaml theme={null}
retry:
  enabled: true
  max_attempts: 3
  backoff_ms: 100
  max_backoff_ms: 5000
```

### Access Log

```yaml theme={null}
access_log:
  enabled: true
  path: "/var/log/ultrabalancer/access.log"
  format: "json"  # or "combined"
```

### TLS

```yaml theme={null}
tls:
  enabled: true
  cert_path: "/etc/ultrabalancer/cert.pem"
  key_path: "/etc/ultrabalancer/key.pem"
  min_version: "1.2"
```

### Logging

```yaml theme={null}
logging:
  level: "info"   # trace, debug, info, warn, error
  format: "text"  # or "json"
  output: "stdout"  # or file path
```

### Metrics

```yaml theme={null}
metrics:
  enabled: true
  endpoint: "/metrics"
  prometheus_endpoint: "/prometheus"
```

## Environment Variable Substitution

```yaml theme={null}
listen_port: ${LISTEN_PORT}
backends:
  - host: "${BACKEND_HOST}"
    port: ${BACKEND_PORT}
```

## Validate

```bash theme={null}
ultrabalancer validate -c config.yaml
```

## Related

* [Configuration Overview](/configuration/overview)
* [CLI Reference](/configuration/cli-reference)
