Codebase analysis · CoreStory V3

Traefik

An open-source edge router and reverse proxy, written in Go. It discovers services from Docker, Kubernetes and other providers and routes HTTP, TCP and UDP traffic to them, with TLS and middleware support. Maintained by Traefik Labs.

Maintained by
Traefik Labs
License
MIT
Commit analyzed
b45eeb07b7b15e8b4bb85a7b0ed8a32eaa75c8c9
Rules extracted
2026-11-15
Extracted by CoreStory V3
15160
accepted rules, each with a cited source quote
20
capabilities
2866
features
01 · Rules

Business rules, traced to source lines.

These 12 rules are a sample of the 15,160 CoreStory V3 extracted from Traefik. Each one links to the exact lines on GitHub at commit b45eeb0. The statement is CoreStory V3’s wording; the code excerpt is the source it cites.

limit
pkg/server/keep_alive_middleware.go

When the connection state exists and maxRequests is greater than 0, once the connection's HTTPRequestCount reaches or exceeds maxRequests, the middleware sets the KeepAliveState to "Close because of too many requests" and sets the response Connection header to "close".

  • 0 — threshold above which maxRequests must be for the limit to apply
  • Close because of too many requests — KeepAliveState value recorded when the limit is reached
  • close — Connection response header value set when the limit is reached
if maxRequests > 0 && state.HTTPRequestCount >= maxRequests { log.Debug().Msg("Close because of too many requests") state.KeepAliveState = "Close because of too many requests" rw.Header().Set("Connection", "close") }

Also cited: L15

limit
pkg/server/router/router.go

A router priority greater than maxUserPriority is rejected unless the router name ends with "@internal"; maxUserPriority is math.MaxInt - 1000.

  • 1000 — amount subtracted from math.MaxInt to derive max user priority
  • @internal — router name suffix exempt from the priority limit
if routerConfig.Priority > maxUserPriority && !strings.HasSuffix(routerName, "@internal") { err = fmt.Errorf("the router priority %d exceeds the max user-defined priority %d", routerConfig.Priority, maxUserPriority) routerConfig.AddError(err, true) logger.Error().Err(err).Send() continue }

Also cited: L31

limit
pkg/provider/http/http.go

When MaxResponseBodySize is non-negative, the response body is read with a limit of MaxResponseBodySize+1 bytes, and a response body whose length is greater than MaxResponseBodySize is rejected as too large; when MaxResponseBodySize is negative the entire body is read without limit.

  • 1 bytes — extra byte added to the read limit to detect oversize bodies
if p.MaxResponseBodySize < 0 { return io.ReadAll(res.Body) } data, err := io.ReadAll(io.LimitReader(res.Body, p.MaxResponseBodySize+1)) if err != nil { return nil, fmt.Errorf("reading response body: %w", err) } if int64(len(data)) > p.MaxResponseBodySize { return nil, errors.New("response body too large") }
validation
pkg/server/service/service.go

A mirroring service with StreamBody true, MirrorBody true, and MaxBodySize greater than or equal to 0 is rejected with the error "maxBodySize cannot be used with streamBody"; the mirror body default is MirroringDefaultMirrorBody and the max body size default is MirroringDefaultMaxBodySize.

  • 0 — threshold for maxBodySize rejection condition (>= 0)
// The body is never buffered when streamed, so there is no body size to bound. if config.StreamBody && mirrorBody && maxBodySize >= 0 { return nil, errors.New("maxBodySize cannot be used with streamBody") }

Also cited: L292–L300

calculation
pkg/provider/acme/provider.go

getCertificateRenewDurations maps CertificatesDuration in hours to (renew period, renew interval): >= 8760 hours (1 year) returns 4*30*24 hours and 7*24 hours (4 months, 1 week); >= 2160 hours (90 days) returns 30*24 hours and 24 hours; >= 720 hours (30 days) returns 10*24 hours and 12 hours; >= 144 hours (6 days) returns 2*24 hours and 2 hours; >= 24 hours (1 day) returns 6 hours and 10 minutes; otherwise returns 20 minutes and 1 minute.

  • 8760 hours — threshold for at least one year
  • 4 months — renew period for one-year-or-more duration (as 4*30*24 hours)
  • 7 days — renew interval for one-year-or-more duration
  • 2160 hours — threshold for at least 90 days
  • 30 days — renew period for 90-day-or-more duration
  • 24 hours — renew interval for 90-day-or-more duration
  • 720 hours — threshold for at least 30 days
  • 10 days — renew period for 30-day-or-more duration
  • 12 hours — renew interval for 30-day-or-more duration
  • 144 hours — threshold for at least 6 days
  • 2 days — renew period for 6-day-or-more duration
  • 2 hours — renew interval for 6-day-or-more duration
  • 24 hours — threshold for at least 1 day
  • 6 hours — renew period for 1-day-or-more duration
  • 10 minutes — renew interval for 1-day-or-more duration
  • 20 minutes — default renew period
  • 1 minutes — default renew interval
func getCertificateRenewDurations(certificatesDuration int) (time.Duration, time.Duration) { switch { case certificatesDuration >= 365*24: // >= 1 year return 4 * 30 * 24 * time.Hour, 7 * 24 * time.Hour // 4 month, 1 week case certificatesDuration >= 3*30*24: // >= 90 days return 30 * 24 * time.Hour, 24 * time.Hour // 30 days, 1 day case certificatesDuration >= 30*24: // >= 30 days return 10 * 24 * time.Hour, 12 * time.Hour // 10 days, 12 hours case certificatesDuration >= 6*24: // >= 6 days return 2 * 24 * time.Hour, 2 * time.Hour // 2 days, 2 hours case certificatesDuration >= 24: // >= 1 days return 6 * time.Hour, 10 * time.Minute // 6 hours, 10 minutes default: return 20 * time.Minute, time.Minute } }

Also cited: L259–L265

policy
pkg/middlewares/denyrouterrecursion/deny_router_recursion.go

If the incoming request header X-Traefik-Router equals the middleware's stored routerNameHash, the middleware rejects the request by writing HTTP status 400 and returning without invoking the next handler.

  • X-Traefik-Router — request header whose value is compared to the router hash
  • 400 — HTTP status code written for a rejected request
if req.Header.Get(xTraefikRouter) == l.routerNameHash { logger := log.With().Str(logs.MiddlewareType, "DenyRouterRecursion").Logger() logger.Debug().Msgf("Rejecting request in provenance of the same router (%q) to stop potential infinite loop.", l.routerName) rw.WriteHeader(http.StatusBadRequest) return }

Also cited: L14

policy
pkg/provider/kubernetes/gateway/tcproute.go

The backendRef must be granted via a ReferenceGrant check (isReferenceGranted with kind kindTCPRoute, route namespace, group, kind, name, namespace); if not granted, ResolvedRefs=False with reason RefNotPermitted is returned with a message containing the error.

  • RefNotPermitted — ResolvedRefs condition reason when reference is not permitted
if err := p.isReferenceGranted(kindTCPRoute, route.Namespace, group, string(kind), string(backendRef.Name), namespace); err != nil { return serviceName, nil, &metav1.Condition{ Type: string(gatev1.RouteConditionResolvedRefs), Status: metav1.ConditionFalse, ObservedGeneration: route.Generation, LastTransitionTime: metav1.Now(), Reason: string(gatev1.RouteReasonRefNotPermitted), Message: fmt.Sprintf("Cannot load TCPRoute BackendRef %s/%s/%s/%s: %s", group, kind, namespace, backendRef.Name, err), } }
policy
pkg/tls/tlsmanager.go

When no best certificate is found for the requested server name, if sniStrict is true, a debug message is logged and the connection is closed by returning nil, nil; otherwise a default certificate is served (or an error if the store is nil).

bestCertificate := store.GetBestCertificate(clientHello) if bestCertificate != nil { return bestCertificate, nil } if sniStrict { log.Debug().Msgf("TLS: strict SNI enabled - No certificate found for domain: %q, closing connection", domainToCheck) // Same comment as above, as in the isACMETLS case. return nil, nil } if store == nil { log.Error().Msgf("TLS: No certificate store found with this name: %q, closing connection", storeName) // Same comment as above, as in the isACMETLS case. return nil, nil } log.Debug().Msgf("Serving default certificate for request: %q", domainToCheck) return store.GetDefaultCertificate(), nil

Also cited: L231–L237

validation
cmd/traefik/plugins.go

A local plugin name must be unique across the set of local plugins and remote plugins; if a name present in LocalPlugins also exists in Plugins, an error is returned with the message "the plugin's name %q must be unique". Nil Experimental configuration is exempt and returns nil (no error).

for s := range e.LocalPlugins { if _, ok := e.Plugins[s]; ok { return fmt.Errorf("the plugin's name %q must be unique", s) } }

Also cited: L82–L85

validation
pkg/middlewares/snicheck/snicheck.go

For requests with TLS, the TLS options name recorded on the request context (tcp.GetTLSOptionsName(req.Context())) must equal the tlsOptionsName configured for this middleware; if they differ, the middleware responds with HTTP 421 Misdirected Request and does not call the next handler.

  • 421 http-status-code — response status and text when TLS options names differ
if s.tlsOptionsName != tlsOptionsNameUsed { log.Debug(). Str("routerName", s.routerName). Str("req.Host", req.Host). Str("req.TLS.ServerName", req.TLS.ServerName). Msgf("TLS options difference: SNI:%s, Header:%s", tlsOptionsNameUsed, s.tlsOptionsName) http.Error(rw, http.StatusText(http.StatusMisdirectedRequest), http.StatusMisdirectedRequest) return }

Also cited: L32

policy
pkg/server/aggregator.go

For each host (SNI domain) within an entry point, if the routers serving that host resolve to more than one distinct TLS option, all routers in those groups are marked conflicting. If strictTLSOptions is enabled they are logged as disabled; otherwise they are logged as having the default TLS options applied.

  • 1 — number of distinct TLS option groups above which the host is considered conflicting
for domain, routersByOption := range routersByHostAndOption { if len(routersByOption) == 1 { continue } var routersInConflict []string for _, names := range routersByOption { conflicting = append(conflicting, names...) routersInConflict = append(routersInConflict, names...) } if strictTLSOptions { log.Error().Msgf("On EntryPoint %q, Host %q is served by multiple routers with different TLS options, the fallback to the default TLS options being disabled, the following routers are disabled: %v", ep, domain, routersInConflict) continue } log.Error().Msgf("On EntryPoint %q, Host %q is served by multiple routers with different TLS options, default TLSOptions will be applied for the following routers: %v", ep, domain, routersInConflict) }
calculation
pkg/middlewares/ratelimiter/lua.go

The script computes elapsed = t - last, delta = bucket.limit * elapsed, and tokens = bucket.tokens + delta, then caps tokens at bucket.burst and finally decrements tokens by 1.

  • 1 — amount decremented from tokens
local elapsed = t - last local delta = bucket.limit * elapsed local tokens = bucket.tokens + delta tokens = math.min(tokens, bucket.burst) tokens = tokens - 1
02 · Capabilities

What the application does

20 capabilities identified, grouping 189 of the 3,100 distinct features extracted. Most extracted features are not grouped under a capability, so this list is a partial view of the application. These are descriptions, not the cited rules above.

TLS and Certificate Management

Provisioning, storing, resolving, and terminating TLS certificates and options, including automatic ACME issuance and renewal.

  • ACME Certificate Management: Obtain and renew TLS certificates automatically via ACME, supporting both HTTP and TLS challenges.
  • Automatic Certificate Management: Obtains and renews TLS certificates automatically via an ACME certificate resolver using HTTP or TLS challenges.
  • Automatic Certificate Management (ACME): Automatically obtains and renews TLS certificates from ACME-compatible certificate authorities based on configured domains.
  • Certificate Renewal: Automatically renews certificates before expiry based on configured renewal durations.
  • Certificate Store Management: A store that holds certificates and can be created, refreshed, or reset for subsequent lookups.
  • OCSP Stapling: Supports OCSP stapling for TLS certificates.
  • SNI-Based Certificate Routing: Users can route incoming TLS connections to certificates based on the requested server name, with optional strict matching.
  • SNI-based TLS Routing: Selects a backend route based on the TLS Server Name Indication presented during a connection.
  • TLS Certificate Configuration: Configure TLS termination for routes using certificates and secret references.
  • TLS Certificate Management: Provisioning of TLS certificates and keys for secure ingress termination.
  • TLS Certificate and Store Management: Manage TLS certificates, options, and stores including ACME resolvers, default certificates, and client authentication.
  • TLS Configuration: Configure TLS options for securing routed connections.
  • TLS Termination: Provides TLS handling and server transports for securing routed connections.
  • TLS Termination & Certificate Handling: Serves HTTPS using certificate pairs and configurable TLS options, including TLS passthrough and client certificate authentication.
  • TLS Termination & Mutual TLS: Configures TLS termination including version constraints, cipher suites, client certificate authentication, and SNI strictness.
  • TLS Termination and Certificate Management: Configuration of TLS termination for ingress traffic including certificate resolvers, secrets, and server name matching.
  • TLS Termination and Client Certificate Handling: Terminate TLS connections with configured certificates and pass client certificate info to backends.
  • TLS/HTTPS Secure Endpoint: Serves traffic over encrypted TLS connections on configured ports.
  • TLS/HTTPS Termination: Serves encrypted HTTPS traffic using TLS certificate and key secrets.
  • TLS/SSL Configuration: Ability to configure TLS termination with certificates, keys, CA trust, minimum protocol version, and cipher suites.
  • TLSOption Management: Exposes access to Traefik TLSOption custom resources for configuring TLS parameters.

Routing and Traffic Management

Matching and forwarding requests across HTTP, TCP, and UDP protocols to backend services based on rules, hosts, paths, and entry points.

  • Domain-Based Route Matching: Matches requests against configured host/domain patterns to select routes.
  • HTTP Redirects: Redirect client requests to alternate URLs or schemes via regex and scheme rules.
  • HTTP Request Routing: Define HTTP routers that match incoming requests by rule and forward them to a load-balanced backend service.
  • HTTP Route Matching: Route external HTTP requests to backend services based on host and path rules.
  • HTTP Route Matching and Traffic Routing: Users define HTTP routing behaviour via path matches tied to a route, enabling request routing decisions.
  • HTTP Routing: Routes incoming HTTP requests to backend services via configurable routers and middleware chains.
  • HTTP Traffic Routing: Routes inbound plain-HTTP requests through a Gateway listener to the web application backend service.
  • Path Prefix Stripping: Strip a configured path prefix from incoming requests before forwarding them to the backend.
  • Route Priority Ordering: Orders routes by priority/precedence so higher-priority rules are evaluated first.
  • TCP Connection Routing: Routes TCP connections to their destinations via a dedicated TCP router.
  • TCP Routing: Routes and load-balances raw TCP connections through TCP routers, services, and middleware.
  • TCP Traffic Routing: Forwards raw TCP connections through a TCP Gateway to the TCP backend service.
  • UDP Datagram Routing: Routes UDP datagrams to their destinations via a dedicated UDP router.
  • UDP Routing: Routes UDP datagrams to backend UDP services through configurable UDP routers.
  • URL Rewriting: Rewrite request URLs and upstream Host headers.
  • URL Rewriting and Redirection: Rewrite request paths or issue redirects using regex and scheme-based rules.

Dynamic Provider Integration

Plugging in external infrastructure providers (Docker, Consul, Nomad, etcd, Redis, file) that supply dynamic service and routing configuration.

  • Consul Catalog Integration: Discovery of services and their health status from the Consul service catalog, including default service configuration handling.
  • Docker Provider Client Setup: Create and configure the Docker API client, including endpoint, credentials, TLS, and timeout settings for connecting to the Docker daemon.
  • Dynamic Provider Configuration: Allows providers to be built and configured from loaded configuration templates with defaults and per-service settings.
  • Extension Builder Registry: Registers and resolves extension builders for provider plugin functionality.
  • File Provider Configuration: Loading of routing and service configuration from a watched file with optional hot reload.
  • File-Based Configuration: Load routing and service configuration dynamically from a watched configuration file.
  • File-Based Configuration Loading: Load dynamic routing and TLS configuration from an external file provider.
  • Plugin Extension System: Load and manage local and remote plugins extending core functionality.
  • Provider Discovery: Service and routing configuration is discovered from a range of external infrastructure and file providers.
  • Provider Registration: Allows providers to be added to the aggregator, including quiet registration and bounded/throttled registration.
  • Provider Registration and Initialization: Register providers and initialize their configuration within the system.
  • Redis Configuration: Allows users to configure Redis provider integration settings.
  • etcd Configuration: Allows users to configure etcd provider integration settings.

Gateway API

Modeling and reconciling Kubernetes Gateway API resources — GatewayClasses, Gateways, HTTP/TCP/TLS/gRPC routes, listeners, and reference grants — into routing configuration.

  • Cross-Namespace Reference Grants: Enforces and resolves ReferenceGrant-based permissions for cross-namespace route and backend references.
  • Gateway API: Models and implements the Kubernetes Gateway API, letting users define gateways and route traffic to backends via TCP routes.
  • Gateway API Conformance Testing: Runs the merged Gateway API conformance test suite and reports the results.
  • Gateway API Resource Definition: Users declare Gateway API networking resources such as GatewayClass, Gateway, and HTTPRoute with listeners, rules, matches, and backend references.
  • Gateway API Resource Model: Defines the Kubernetes Gateway API resource types that users and controllers declare and reconcile to configure ingress traffic, TLS, and gRPC routing.
  • Gateway API Resource Modeling: Defines the Kubernetes Gateway API resource types (Gateways, GatewayClasses, HTTPRoutes, backend TLS policies, and referenced ConfigMaps/Secrets) that users author and apply to configure ingress and traffic routing.
  • Gateway API Routing: HTTP traffic is routed to backend services via Gateway API HTTPRoute resources with hostname, path matching, and backend references.
  • Gateway API Routing Model: Defines the Kubernetes Gateway API resources (Gateway, GatewayClass, HTTPRoute, and BackendTLSPolicy) that let users declare gateway classes, gateway listeners, HTTP routing rules, and backend TLS policies.
  • Gateway API Status Reporting: Records status conditions for Gateway API resources such as GatewayClasses, Gateways, and routes (HTTP, TCP, TLS, GRPC) onto a status report.
  • Gateway Class Configuration: Define and instantiate a gateway implementation through GatewayClass and Gateway resources.
  • Gateway Listener Processing: Selects and builds per-listener routers from Gateway listener definitions, applying hostname matching and listener-to-route binding.
  • Gateway Provisioning: Define and expose an API gateway with an associated gateway class so that clients can connect through it.
  • GatewayClass Configuration: Define the controller implementation that manages gateways via a GatewayClass resource.

Entry Points and Protocol Support

Defining HTTP/HTTPS, HTTP/2, HTTP/3, TCP, and UDP entry points that accept and serve incoming traffic.

  • Connection Hijacking: Exposes the underlying network connection from an HTTP response so callers can take over the raw socket.
  • Entry Point Configuration: Configure named network entry points (web and websecure) that receive incoming traffic.
  • HTTP Entry Point Configuration: Define and expose HTTP(S) listening entry points with protocol options, header handling, timeouts, and TLS termination so traffic can be received and routed.
  • HTTP to HTTPS Redirect: Redirects incoming insecure HTTP requests to the secure HTTPS scheme on the configured port.
  • HTTP/2 and h2c Support: Serving requests over HTTP/2, including cleartext h2c connections and HTTP/2 request TLS handling.
  • HTTP/3 Server Support: Serves requests over the HTTP/3 (QUIC) protocol, including advertisement of the HTTP/3 port and server timeout configuration.
  • Proxy Protocol Support: A user-facing capability to handle PROXY protocol requests, including trusted and untrusted client scenarios.
  • TCP Entry Point Serving: Accepts and serves incoming traffic over configured TCP entry points.
  • TCP Entry Points: Accepts and manages TCP listener entry points through which traffic enters the system.
  • Traefik Entrypoint Configuration: Declares the network entrypoints (global, web, websecure) through which incoming traffic is accepted into the proxy.
  • UDP Entry Point Management: Manage UDP network entry points including their lifecycle and switching, with configurable transport and listener/switcher controls.
  • WebSocket Proxying: Proxies WebSocket connections between clients and backend servers, including echoing traffic, forwarding traffic, host handling, ping/pong, and TCP close propagation.

Kubernetes Client and CRD Management

Establishing Kubernetes API clients and defining, registering, and managing the CRD resource types and typed clientsets.

  • Custom Resource API Definition: Define the served Kubernetes custom resource API surface including versions, scope, and naming.
  • Custom Resource Definition Schema: Define API resources via CRD structure including versions, spec schema, and validation.
  • Kubernetes Client Connection Management: Establish and manage clients to the cluster, including in-cluster and external/kubeconfig-based connections.
  • Kubernetes Client Creation: Creates authenticated Kubernetes API clients from in-cluster, external cluster, or file-based configuration.
  • Kubernetes Cluster Client Connection: Establish authenticated connections to in-cluster or external Kubernetes clusters from configuration.
  • Kubernetes Custom Resource Definition: Registration of a Kubernetes CustomResourceDefinition so that custom ingress resources and their API versions can be created and managed by the cluster.
  • Kubernetes Resource Informers: Provides watch-based access to Kubernetes resources such as services, nodes, ingresses, and secrets.
  • Kubernetes Resource Retrieval: Fetch Kubernetes and Traefik custom resources (ingress routes, middlewares, services, TLS options, secrets, nodes, endpoint slices, and more) by name from the cluster.
  • Resource CRUD Management: Create, read, update, patch, and delete lifecycle operations for resources in the v1alpha1 API group.
  • Scheme Installation: Installs the API group's types and version into a runtime scheme so serialization and client operations recognize the resources.
  • Shared Informer Factory: Provides a reusable factory that creates and manages shared informers for Kubernetes resources, letting consumers start, sync, and shut down cache-backed watches.
  • Traefik v1alpha1 Client: Provides a Kubernetes clientset for accessing Traefik v1alpha1 custom resources, enabling consumers to construct and query Traefik CRDs through a typed client interface.

Middleware Pipeline

Composing and attaching ordered middleware chains that transform, secure, and control request and response handling.

  • Cross-Origin Resource Sharing: Control cross-origin access with allowed origins, methods, headers, and credentials.
  • Custom Error Pages: Serving configured error responses, such as a custom error page, when requests fail.
  • Custom HTTP Error Pages: Serves configurable custom error responses from designated error backends.
  • HTTP Middleware Chaining: Compose and apply a named chain of HTTP request/response middlewares to routes.
  • HTTP Request Header Modification: Middleware capability that sets, adds, or removes HTTP request headers before forwarding a request to the next handler.
  • Header Manipulation: Add, remove, or rewrite request and response headers, including prefixes.
  • Middleware Attachment: Attach reusable middleware behaviors to routes to process requests in the routing pipeline.
  • Middleware Chain Configuration: Users compose a sequential chain of middleware handlers that requests flow through, supporting ordered application and execution.
  • Middleware Chaining: Association of reusable middleware components with routers to transform requests and responses.
  • Middleware Pipeline: Attaches middlewares to services and applies the middleware chain to requests.
  • Middleware Pipeline Configuration: Attachment of middleware chains to routers and global request processing.
  • Path Rewriting: Modifies request paths by stripping or replacing path prefixes before forwarding.

Authentication

Authenticating requests via basic, digest, forward auth, tokens, and external auth services, including mutual TLS client certificate verification.

  • Authentication: Authenticate incoming requests using basic, digest, or forward auth mechanisms.
  • Basic Authentication: Protects an ingress endpoint with HTTP basic authentication using an auth secret, realm, and secret type.
  • Client Certificate Authentication: Authenticate clients via mutual TLS, including support for multiple certificate authorities and certificate files.
  • Digest Access Authentication: Constructs an HTTP Digest authentication request, generating parts, a random nonce, and an MD5-based Authorization header carrying credentials and realm/algorithm/qop parameters.
  • Digest Authentication: Provides digest-based authentication for incoming requests, gated by an allowlist and redirect configuration.
  • Forward Authentication: Delegates request authentication to an external forward-auth service and forwards the request, body, headers, and method based on that service's response.
  • HTTP Authentication: Provides basic, digest, and forward authentication mechanisms for protecting routes.
  • Mutual TLS Client Authentication: Ingress endpoints enforce client certificate verification via mTLS through the auth-tls annotations and a TLS secret.
  • OAuth Token Introspection: Validates bearer tokens via an OAuth introspection endpoint before serving requests.
  • Request Authentication: Authenticate incoming requests using basic, digest, and forward auth mechanisms.
  • Token-Based Authentication: Authenticates requests by resolving a user from a supplied token via the auth handler.

Configuration Management

Loading, merging, validating, and dynamically reloading configuration from providers and files.

  • Configuration Loading: Loads and assembles the mesh-wide configuration from structured data so users can define providers, tracing, and protocol settings.
  • Configuration Management: Defines and manages configuration settings, including TLS options, for the application.
  • Configuration Merge: Merges multiple named configurations into a single combined store, resolving conflicting resource definitions.
  • Configuration Validation: Validates static and dynamic configuration, including router and service config errors for HTTP, TCP, and UDP, and fails invalid configs.
  • Configuration Watching: Continuously watches configuration providers and republishes updated configuration to consumers.
  • Declarative Configuration Merge: Merges multiple declarative configuration sets into a single combined configuration, resolving conflicts and deletions across items, resources, servers, and embedded structures.
  • Dynamic Configuration Reload: Watches for configuration changes from providers and applies updated configurations to the running system at runtime.
  • File-Based Configuration: Loads routing, service, and certificate configuration from a watched configuration file.
  • Live Configuration Watching: Watches configuration sources and reacts to changes while the server runs.
  • Provider Configuration: Lets users configure the platform providers (Kubernetes, Consul, Docker, etc.) that the mesh discovers services from.
  • Static Configuration: Operators define and load the global configuration that sets entrypoints, providers, and global options for the instance.

Dashboard and Administrative API

Exposing a user-facing dashboard and REST/HTTP API for inspecting and managing routing state and configuration.

  • API Error Reporting: Returns structured JSON error responses to API consumers when a request cannot be served.
  • Dashboard: Built-in web dashboard exposing routers, services, and status to users.
  • Dashboard API: Exposes an HTTP API for inspecting and controlling the running configuration.
  • Dashboard Access: Provides a web dashboard for monitoring and inspecting router configuration, including a redirect from the stripped-prefix base path.
  • HTTP API: Exposes an HTTP-based API endpoint for programmatic access.
  • REST API: Serves a REST API for managing and querying routers, services, and other configuration.
  • Secure API: Provides authenticated access to the API endpoints.
  • Service Information Retrieval: Exposes runtime service information via an API so that consumers can observe which services and providers are configured.
  • Traefik API/Dashboard Access: Exposes the Traefik control API and dashboard so operators can inspect routing state.
  • Web Dashboard: Built-in web dashboard exposing the current routing and service state.
  • Web Dashboard Access: Exposes a web dashboard for browsing routing configuration and server status.

Observability

Exposing metrics, access logs, and distributed traces for monitoring and diagnosing proxied traffic.

  • Access Logging: Records HTTP access logs through configurable log handlers and middleware.
  • Distributed Tracing: Creating and recording spans and events with attributes, status, names, and links via a tracer provider.
  • HTTP Access Logging: Writing structured access log entries for HTTP requests, including buffering, rotation, and configurable field formats (CLF, JSON, headers).
  • Metrics Export: Exposes collected metrics to external monitoring backends like Prometheus, StatsD, Datadog, InfluxDB2, and OTLP over a configured push interval.
  • Observability: Emit metrics, access logs, and distributed traces for proxied traffic.
  • Observability and Metrics: Exposes access logs, metrics, and tracing data so operators can monitor the service.
  • OpenTelemetry Metrics Export: Registers and manages OpenTelemetry instrumentation with OTLP exporters to export application metrics to an observability backend.
  • OpenTelemetry Tracing Integration: Traefik's ability to emit distributed traces to an OpenTelemetry collector, exercised and verified through end-to-end test scenarios over HTTP and gRPC.
  • Prometheus Metrics: Exposes Prometheus metrics and stats per router, service, and entry point, including buffering middleware.
  • Router Traffic Metrics: Exposes request counts, byte volumes, TLS usage, and request duration for routers.
  • Service Traffic Metrics: Exposes request counts, byte volumes, TLS usage, duration, retries, and server-up status for services.

Service Discovery

Discovering backend services and endpoints from Kubernetes and other infrastructure providers, including EndpointSlices and service resolution.

  • Consul Service Catalog: Integrates a Consul service catalog as a proxied backend, including options for enabling it and canary/connect behavior.
  • Docker Container Inspection: Discover and inspect running Docker containers to determine their network endpoints, ports, and exposed status for routing.
  • Endpoint Slice Discovery: Provides scalable endpoint discovery through EndpointSlice resources with addresses and conditions.
  • Kubernetes Service Exposure: Expose Kubernetes services to users through configured entry points, load-balancer node ports, and routing services.
  • Nomad Service Discovery: Dynamically discovers and resolves backend service endpoints from a Nomad cluster, including polling or watching for changes and throttling update events.
  • Provider Integration: Loads and aggregates service discovery providers, including Tailscale and plugin-based providers, to supply routing configuration.
  • Service Discovery: Discovers and retrieves service instances from Consul for use by the system.
  • Service Discovery Propagation: Propagates routing and health-check configuration from a discovery provider to routers, including live reload of changes.
  • Service Discovery Provider Integration: Discovers routing configuration from multiple infrastructure providers such as Docker, Kubernetes, Consul, Etcd, ECS, and others.
  • Service Endpoint Discovery: Tracks the ready backend addresses and ports that make up a service's routable endpoints.
  • Service Resolution: Resolves named services to their URLs for request forwarding.

Access Control

Granting or denying requests based on IP allow/deny lists, source ranges, host restrictions, and middleware-level authorization.

  • Access Control: Grant or deny requests through access collectable actions gated by access predicates.
  • IP Access Control: Allow or deny requests based on client IP address rules.
  • IP Allow List: Lets an operator define an allow list of source ranges whose traffic is permitted, with real-time tracking of in-flight connections.
  • IP Allow-List Enforcement: Restricts access to a route by matching client connections against a configured list of allowed IP addresses.
  • IP Allowlisting: Allows or denies incoming requests based on client IP address using allowlist/whitelist strategy.
  • IP Whitelisting: Restrict incoming requests to trusted source IP ranges via Traefik IP whitelist middlewares.
  • IP-Based Access Control: Allow or deny requests based on client source IP ranges and host restrictions.
  • Middleware Access Control: Applies middleware-based allow-list and white-list rules to control which requests or connections are permitted.
  • Source IP Allowlisting: Restricts ingress access to a configurable single-CIDR allowlist of source IP ranges.
  • Unknown Host Denial: Blocks requests addressed to unrecognized hosts before they reach any backend service.

Build, Test, and CI Pipeline

Compiling binaries and web assets, running unit, integration, and conformance test suites, and executing CI workflows.

  • Binary Compilation: Compiles the project's source code into runnable binaries.
  • CI Verification Pipeline: Automated end-to-end verification that checks out code, sets up toolchains, and runs build and lint checks.
  • CodeQL Security Analysis: Automatically initializes CodeQL and performs static security analysis on the checked-out repository's code.
  • Container Image Build: Builds and publishes multi-architecture container images for the runtime and web UI.
  • Docker Compose Integration Testing: A test suite capability that provisions and tears down Docker Compose environments to exercise the implementation against running services.
  • Gateway API Conformance Testing: Runs the merged Gateway API conformance test suite and reports the results.
  • Integration Test Execution: Runs integration test suites in a CI job, merging and reporting the aggregated results.
  • Lint and Validation: Validates files and lints the codebase to enforce quality standards.
  • Unit Test Execution: Runs the project's unit test suites to verify behavior.
  • Web UI Build and Clean: Generates and cleans the web UI static assets served to users.

Kubernetes Ingress Integration

Discovering and translating Kubernetes Ingress resources, ingress classes, and their annotations into routing and backend configuration.

  • Ingress Annotation Configuration: Controller-specific behavior configuration supplied via annotations such as source-range allowlisting.
  • Ingress Class Selection: Specification of the ingress controller class responsible for handling the Ingress resource.
  • Ingress Resource Definition: Declarative definition of Kubernetes Ingress resources including routing rules, backend services, and annotations.
  • Ingress Route Configuration: Defines ingress-style routes with entry points and TLS settings so requests can be routed into the system.
  • Ingress Route Management: Defines and manages ingress routes that expose services to external clients.
  • Ingress Routing: Exposes and routes incoming traffic to backend services via declared ingress routes with associated ports, routes, and specs.
  • Ingress Status Update: Publish load balancer ingress status updates and compare them to avoid redundant writes.
  • Ingress TLS Termination: Configures TLS certificates and secret references on Ingress resources to secure inbound HTTPS traffic.
  • IngressRoute Management: Exposes access to Traefik IngressRoute custom resources for managing HTTP routing entries.
  • Kubernetes Ingress Routing: Ability to translate Kubernetes Ingress resources into routing configuration, including ingress class handling, service address/port resolution and namespace access checks.

Load Balancing

Distributing traffic across backend server pools using weighted round-robin, HRW, least-time, failover, and sticky strategies.

  • Backend Server Load Balancing: Routes incoming traffic across a pool of backend servers while tracking their readiness, health status, and usage.
  • Highest Random Weight Load Balancing: A load balancing capability that distributes service traffic across service instances using the highest random weight algorithm.
  • Load Balancing: Distribute traffic across backend servers with weighting and sticky sessions.
  • Server Registration: Add and configure servers through a general registration entry point backed by configuration building.
  • Service Load Balancing: Distributes traffic across backend servers using configurable load-balancing strategies, weights, and sticky sessions.
  • Sticky Sessions: Pin a client's requests to the same backend server across multiple requests using session stickiness.
  • TCP Load Balancing: Distribute TCP connections across backend servers with weighted round-robin.
  • Traffic Weighted Routing: Distribute request traffic across multiple backend services by weight or percentage fraction.
  • UDP Load Balancing: Provides UDP routing and load balancing across backend servers with weighted round-robin distribution.
  • Weighted Round Robin Load Balancing: Distributes connections across backends using weighted round-robin selection.

Rate Limiting and Connection Limiting

Constraining request rates, bursts, and concurrent in-flight connections, including distributed Redis-backed limiting.

  • Connection Limit Enforcement: System enforces a maximum number of concurrent connections by tracking in-flight connections and rejecting or blocking when the limit is reached.
  • Distributed Rate Limiting: Capability that lets clients enforce request rate limits backed by Redis, constructed via a public constructor and exercised against in-memory and Redis-backed test scenarios.
  • In-Flight Connection Limiting: Caps the number of concurrent active TCP connections the service will accept.
  • In-Flight Request Limiting: Limit the number of concurrent in-flight requests.
  • Ingress Rate Limiting: Users can annotate an Ingress resource to limit request rate and concurrent connections to a backend service.
  • Rate Limiting: Throttle incoming requests by average rate and burst capacity per source.
  • Rate and Connection Limiting: Applies request-rate, connection, and burst limits restricted to allowlisted sources.
  • Redis Rate Limiting: Creates a Redis-backed rate limiter configured with rate, burst, period, ttl, and a redis prefix.
  • Request Rate Limiting: Throttle incoming requests according to configured rate limits.
  • Request Throttling: Limit request rates by applying a throttle duration.

Secret and Credential Management

Storing, referencing, and resolving secrets and credentials used by gateways, routes, and backend connections.

  • ConfigMap and Secret Access: Retrieve ConfigMap and Secret resources from the cluster.
  • Credential Removal: Removes credentials from data before it is exported, logged, or otherwise emitted.
  • Credential Secret Management: Stores sensitive credentials such as secrets for use by gateways and routes.
  • Kubernetes Secret Management: Viewing and handling Kubernetes Secret resources with their metadata, spec, and data payloads.
  • Secret Management: Ability to define and manage Kubernetes Secret resources holding user credentials and arbitrary data.
  • Secret Retrieval: Fetches Kubernetes Secrets for use by users or dependent systems.
  • Secret-Based Configuration: Resolves configuration values and credentials from Kubernetes secrets and config maps.
  • Sensitive Header Redaction: Redacts sensitive headers before they are written to the access log.
  • TLS Certificate Secret Management: Storage and association of TLS certificates and keys within a Kubernetes secret referenced by ingress routes to enable HTTPS termination.
  • TLS Secret Management: Supplies the secret material used to secure HTTPS listeners on the gateway.

Traffic Shaping and Resilience

Protecting and shaping traffic with circuit breaking, retries, mirroring, buffering, timeouts, and compression.

  • Circuit Breaking: Trip a breaker on failing backends to shed load and recover automatically.
  • Circuit Breaking and Retries: Protect backends with circuit breakers and automatically retry failed requests.
  • HTTP Request Retry: Automatically retrying failed HTTP requests, including backoff behavior, websocket connections, and URL prefix stripping.
  • HTTP Response Compression: Automatically compress HTTP response bodies using Brotli, Gzip, or Zstandard, with negotiated encoding and correct response headers.
  • Request Buffering: Buffers request and response bodies with configurable memory and size limits.
  • Request Mirroring: Mirror requests to a secondary backend for testing or shadow traffic.
  • Request Retry: Retry failed backend requests according to an expression and attempt count.
  • Response Compression: Compress responses before sending them to clients.
  • Traffic Buffering: Buffer request and response bodies flowing through the proxy.
  • Traffic Mirroring: Mirror a portion of live traffic to one or more additional backend services.

Health Checking

Actively and passively monitoring backend server health to detect and route around unhealthy endpoints.

  • Backend Health Checking: Configures active and passive health checks to detect and route around unhealthy backend servers.
  • Health Check Configuration: Configuration of active and passive health checking for load balancer backends.
  • Health Check Metrics Collection: Collects and records health-check metrics (counters and gauges) that can be observed by monitoring backends.
  • Health Check Status Reporting: Exposes and mutates a health-check status that callers can query and set, with an explicit notion of an empty/unset state.
  • Health Checking: Periodically probe backend servers to detect and eject unhealthy nodes.
  • Passive Health Monitoring: Derive health status from wrapped handler responses without actively probing services.
  • Server Health Monitoring: Continuously monitors upstream server health and signals changes through a watch mechanism and event channel.
  • Service Health Checking: A capability that checks the health of services over HTTP, including redirect handling and request construction, with configurable check intervals.
  • TCP Health Checking: Periodic TCP health checks against backend services, establishing connections and validating responses to determine service availability.
03 · Size

What was analyzed

  • Go · 796 files · 232,076 lines
  • YAML · 704 files · 89,311 lines
  • Markdown · 194 files · 37,904 lines
  • JSON · 153 files · 14,179 lines
  • TypeScript · 184 files · 10,982 lines
  • TOML · 183 files · 6,782 lines
  • JavaScript · 5 files · 311 lines
  • Bourne Shell · 11 files · 262 lines
  • make · 2 files · 183 lines
  • Text · 3 files · 135 lines
  • CSS · 4 files · 95 lines
  • Other (7 languages) · 13 files · 245 lines

Whole repository: 2,418 files. cloc 2.06 counts 392,465 lines of code in 2,252 of them (458,005 lines with comments and blanks).

04 · Source

Where this came from

Extracted by CoreStory V3 (build 4470 with two small engine fixes) using DeepSeek-V4.1-Flash from the public repository at commit b45eeb0 on 2026-11-15. Capability descriptions are from the same run.

Code excerpts are from the upstream repository and remain under its MIT license. CoreStory is not affiliated with or endorsed by Traefik Labs.

Want this for your own codebase?

Talk to us about mapping the business rules in your repositories.

Talk to an expert