Skip to content

Configuration

These complete configurations require a valid Trident Core licence at /etc/trident/license.key, readable by the service user. The explicit license.path below selects that file; mounting a licence without configuring its path does not activate caching. A successful --check validates the configuration, not the entitlement. Verify licensed runtime status and a cacheable MISS followed by HIT with identical complete bodies.

This page describes the Trident 1.8.0 candidate configuration. JSON, JSONC and TOML are supported. Validate an upgrade configuration with the actual candidate before changing the installed service.

Complete example

Save this as /etc/trident/config.json, set TRIDENT_ADMIN_TOKEN to a strong operator-managed value in the service environment, and replace example.com and the origin address with your actual values. This example explicitly uses a 60-second grace window and admin port 6085; these are selected values, not all of the parser's implicit defaults.

{
  "license": {
    "path": "/etc/trident/license.key"
  },
  "security": {
    "trusted_proxies": [
      "127.0.0.1/32"
    ]
  },
  "server": {
    "listeners": [
      {
        "address": "0.0.0.0:8120"
      }
    ],
    "timeouts": {
      "connect": "5s",
      "header_read": "10s",
      "body_read": "60s",
      "idle_keepalive": "60s",
      "backend_connect": "5s",
      "backend_first_byte": "60s",
      "backend_between_bytes": "30s"
    },
    "limits": {
      "max_connections": 10000,
      "max_header_size": "32 KiB",
      "max_body_size": "10 MiB",
      "max_uri_length": 8192,
      "max_header_count": 100
    },
    "preserve_host": true
  },
  "backends": [
    {
      "name": "origin",
      "host": "127.0.0.1",
      "port": 8080
    }
  ],
  "cache": {
    "enabled": true,
    "max_memory": "1 GiB",
    "grace_period": "60s",
    "poisoning": {
      "known_hosts": [
        "example.com",
        "localhost",
        "127.0.0.1"
      ]
    },
    "stale_while_revalidate": {
      "enabled": true
    }
  },
  "ttl": {
    "mode": "origin",
    "default": "1h",
    "max": "24h"
  },
  "admin": {
    "enabled": true,
    "address": "127.0.0.1:6085",
    "auth_token": "${TRIDENT_ADMIN_TOKEN}"
  },
  "logging": {
    "level": "info",
    "format": "json"
  }
}
Check the literal file without starting or reloading a service:

trident --config /etc/trident/config.json --check

--check validates the configuration; it does not prove that a backend is reachable or that an installed service has adopted the file. Keep the file, any includes, environment substitutions and licence readable by the service identity. Do not place a real admin token in source control.

Listeners, backends and trust

  • server.listeners is an array of objects with address; server.listen is not a valid field. tls: true selects a TLS listener and requires the corresponding certificate configuration.
  • Each backend uses separate host and port fields. A backend address string is not the current schema.
  • server.preserve_host defaults to false. Set it to true when an application must receive the original authority. When it is false, include_backend_port_in_host controls non-default backend ports and itself defaults to false.
  • A public listener with poisoning protection enabled requires real allowed hostnames in cache.poisoning.known_hosts or per-site server_name declarations. Replace example names with the names you serve. Do not disable the check merely to make an example start.
  • security.trusted_proxies defines which immediate peers may supply forwarding identity. Trust only the actual proxy addresses/CIDRs. A TLS edge must overwrite incoming forwarding fields before sending traffic to Trident; see the nginx and Apache examples.

Timeout defaults and meaning

Field in server.timeouts Implicit default Meaning
header_read 10s Client request-header deadline
body_read 60s Client request-body deadline
idle_timeout 60s Idle gap while no request is in flight
max_connection_age unset Connection lifetime cap; falls back to idle_keepalive
idle_keepalive 60s Legacy lifetime-cap fallback, not the between-request idle timeout
backend_connect 5s Establishing an origin connection
backend_first_byte 60s Waiting for origin response headers
backend_between_bytes 30s Origin body progress deadline
backend_total_body 300s Total origin body-collection deadline
graceful_shutdown 30s Bounded draining of in-flight work
tls_handshake 10s TLS handshake deadline

The parsed connect setting defaults to 5s; current client handling does not use it as an additional accept-connection deadline. Configure the actual header, TLS and backend deadlines above for those operations. Connection-age shutdown stops accepting new work and drains existing work within the drain window; it is separate from an idle-gap deadline.

Resource defaults

Field in server.limits Implicit default
max_connections 10000
max_connections_per_ip 100
max_header_size 32 KiB
max_header_count 100
max_request_line 8192
max_uri_length 8192
max_body_size 10 MiB

Configured object/cache/body budgets do not equal the entire process RSS. Keep aggregate buffering and streaming budgets enabled when changing object limits. A configuration check does not establish a capacity rating.

Cache and TTL

Field Implicit default Meaning
cache.enabled true Shared-cache operation enabled, subject to admission and licensing
cache.max_memory 1 GiB Configured cache budget
cache.max_entries 1000000 Entry-count pressure reference
cache.max_entry_size 10 MiB Individual stored-object ceiling
cache.grace_period 1h Configured stale window; the example explicitly selects 60s
cache.stale_while_revalidate.enabled true Enable supported stale/background-refresh behaviour
ttl.mode origin Use origin freshness policy
ttl.default 1h Fallback freshness when applicable
ttl.max 24h Maximum configured freshness

max_entries is the reference for entry-count eviction and hot-cache PASS thresholds. With default thresholds, eviction starts at 85% and targets 75% through bounded inline and background batches. It does not atomically reserve one entry slot for every in-flight fill: concurrent fills can overshoot the configured number before later bounded drains. Byte admission is enforced separately.

cache.stale_while_revalidate is an object containing enabled; a bare boolean is rejected. ttl.mode = "override" changes freshness calculation for otherwise cacheable responses. It does not make private, forbidden or session-specific responses safe to store. Existing admission, cookie, Authorization and Vary rules still apply.

Administration and logging

The parser's implicit admin address is 127.0.0.1:9000. The shipped Linux configuration and the example above explicitly select 127.0.0.1:6085. Use the effective configured value; do not infer it from a container's exposed port labels. Admin is enabled by default, and its authentication policy is separate from the network binding. If no explicit token is configured, the current implementation normally generates a secret file; configure its path and ownership for the service user rather than assuming an unauthenticated API.

Use GET /admin/health for process health and GET /admin/ready for backend readiness on the admin listener. These health routes are exempt from admin bearer authentication; keep the listener private. Mutating operations require the configured authentication. A request to /health on the proxy listener is ordinary application traffic unless your origin/rules define it.

logging.level defaults to info; logging.format accepts json, pretty and compact, and defaults to json. The value text is rejected. The chosen example explicitly uses JSON.

Installed file selection

Deployment Configuration selection
Linux packages /etc/trident/config.json and /etc/trident/config.toml are shipped; the service's TRIDENT_CONFIG selects its active file
FreeBSD Configuration under /usr/local/etc/trident; inspect the installed rc configuration
Docker The image command selects /etc/trident/config.toml; override the command explicitly when mounting JSON
Direct binary Pass --config explicitly

Preserve operator-owned files on upgrade. Some settings require a restart; validation alone is not acknowledgement that a reload applied every field. Follow the release upgrade instructions and verify installed process/config identity before directing traffic to the candidate.

Included configuration files

An include-only fragment is not a complete main configuration. This complete main file provides its listener/backend and merges any matching JSON includes relative to the main file's directory:

{
  "license": {
    "path": "/etc/trident/license.key"
  },
  "security": {
    "trusted_proxies": [
      "127.0.0.1/32"
    ]
  },
  "server": {
    "listeners": [
      {
        "address": "0.0.0.0:8120"
      }
    ],
    "timeouts": {
      "connect": "5s",
      "header_read": "10s",
      "body_read": "60s",
      "idle_keepalive": "60s",
      "backend_connect": "5s",
      "backend_first_byte": "60s",
      "backend_between_bytes": "30s"
    },
    "limits": {
      "max_connections": 10000,
      "max_header_size": "32 KiB",
      "max_body_size": "10 MiB",
      "max_uri_length": 8192,
      "max_header_count": 100
    },
    "preserve_host": true
  },
  "backends": [
    {
      "name": "origin",
      "host": "127.0.0.1",
      "port": 8080
    }
  ],
  "cache": {
    "enabled": true,
    "max_memory": "1 GiB",
    "grace_period": "60s",
    "poisoning": {
      "known_hosts": [
        "example.com",
        "localhost",
        "127.0.0.1"
      ]
    },
    "stale_while_revalidate": {
      "enabled": true
    }
  },
  "ttl": {
    "mode": "origin",
    "default": "1h",
    "max": "24h"
  },
  "admin": {
    "enabled": true,
    "address": "127.0.0.1:6085",
    "auth_token": "${TRIDENT_ADMIN_TOKEN}"
  },
  "logging": {
    "level": "info",
    "format": "json"
  },
  "include": [
    "sites-enabled/*.json"
  ]
}
Keep included files and directories readable by the service user. Includes must use the current strict schema as well. Unknown fields and invalid values are reported by --check; a rejected reload must not be treated as accepted.