traefik/traefik
Configuration reference
The two top-level configuration kinds and how their sub-blocks map to packages.
Static configuration
Defined in pkg/config/static/static_config.go. Everything in the Configuration struct can be set via:
- File:
traefik.yml,traefik.toml,traefik.json. - CLI flags:
--global.checkNewVersion=true. - Environment variables:
TRAEFIK_GLOBAL_CHECKNEWVERSION=true.
global: {}
serversTransport: {}
tcpServersTransport: {}
entryPoints: {}
providers: {}
api: {}
metrics: {}
ping: {}
log: {}
accessLog: {}
tracing: {}
hostResolver: {}
certificatesResolvers: {}
experimental: {}
core: {} # deprecated
spiffe: {}
ocsp: {}| Block | Type | Implementation |
|---|---|---|
global |
*Global |
pkg/config/static/static_config.go |
serversTransport |
*ServersTransport |
pkg/server/service/transport.go |
tcpServersTransport |
*TCPServersTransport |
pkg/server/service/tcp/transport.go |
entryPoints |
EntryPoints |
pkg/config/static/entrypoints.go, pkg/server/server_entrypoint_*.go |
providers |
*Providers |
pkg/provider/* |
api |
*API |
pkg/api/handler.go |
metrics |
*Metrics |
pkg/observability/metrics/* |
ping |
*ping.Handler |
pkg/ping/ |
log, accessLog |
log types | pkg/observability/logs, pkg/middlewares/accesslog |
tracing |
*Tracing |
pkg/observability/tracing/tracing.go |
hostResolver |
*HostResolverConfig |
pkg/types/host_resolver.go |
certificatesResolvers |
map[string]CertificateResolver |
pkg/provider/acme, pkg/provider/tailscale |
experimental |
*Experimental |
pkg/config/static/experimental.go, pkg/plugins/* |
spiffe |
*SpiffeClientConfig |
cmd/traefik/traefik.go, pkg/server/service/transport.go |
ocsp |
*tls.OCSPConfig |
pkg/tls/ocsp.go |
Defaults
Some defaults of note (see pkg/config/static/static_config.go):
const (
DefaultInternalEntryPointName = "traefik"
DefaultGraceTimeout = 10 * time.Second
DefaultIdleTimeout = 180 * time.Second
DefaultReadTimeout = 60 * time.Second
DefaultAcmeCAServer = "https://acme-v02.api.letsencrypt.org/directory"
DefaultUDPTimeout = 3 * time.Second
)SetEffectiveConfiguration() fills these in and reconciles cross-field implications (e.g. enabling the traefik entry point when the API is on).
Dynamic configuration
Defined in pkg/config/dynamic/. Top-level type:
type Configuration struct {
HTTP *HTTPConfiguration
TCP *TCPConfiguration
UDP *UDPConfiguration
TLS *TLSConfiguration
}Each sub-configuration:
| Section | Type | File |
|---|---|---|
http.routers |
map[string]*Router |
pkg/config/dynamic/http_config.go |
http.services |
map[string]*Service |
pkg/config/dynamic/http_config.go |
http.middlewares |
map[string]*Middleware |
pkg/config/dynamic/middlewares.go |
http.serversTransports |
map[string]*ServersTransport |
pkg/config/dynamic/http_config.go |
tcp.routers |
map[string]*TCPRouter |
pkg/config/dynamic/tcp_config.go |
tcp.services |
map[string]*TCPService |
pkg/config/dynamic/tcp_config.go |
tcp.middlewares |
map[string]*TCPMiddleware |
pkg/config/dynamic/tcp_middlewares.go |
udp.routers |
map[string]*UDPRouter |
pkg/config/dynamic/udp_config.go |
udp.services |
map[string]*UDPService |
pkg/config/dynamic/udp_config.go |
tls.certificates |
[]*tls.CertAndStores |
pkg/tls/tls.go (referenced from dynamic) |
tls.options |
map[string]Options |
pkg/tls/tls.go |
tls.stores |
map[string]Store |
pkg/tls/tls.go |
Where dynamic configuration comes from
A Configuration is produced by every provider (see Providers) and merged by the configuration watcher (see Configuration).
Generated reference docs
End-user-facing reference pages are produced by go generate ./...:
docs/content/reference/static-configuration/cli.md
docs/content/reference/static-configuration/env.md
docs/content/reference/static-configuration/file.md
docs/content/reference/dynamic-configuration/{file,docker,kubernetes-crd,kubernetes-gateway,marathon,nomad,…}.mdAfter changing any field tag in pkg/config/static or pkg/config/dynamic, run make generate to refresh them.
Entry points for modification
- New static field: add to the relevant struct, run
make generate, document underdocs/content/reference/static-configuration/. - New dynamic field: same plus run
make generate-crdto refresh deepcopy code. - Defaults: in
SetDefaultsmethods on the type, or as constants near the top ofstatic_config.go.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.