traefik/traefik
REST provider
The REST provider exposes an HTTP endpoint on Traefik itself that accepts pushed configurations. Where the HTTP provider polls outbound, REST receives inbound.
Source
pkg/provider/rest/rest.go (one file). It registers a route on the traefik internal entry point and dispatches incoming bodies as dynamic.Message.
Configuration
providers:
rest:
insecure: falseSetting insecure: true exposes the endpoint on the default entry point (:80) — only useful for local experimentation. The recommended pattern is to keep insecure: false, expose the traefik entry point on a private network, and protect it with a basic-auth or forward-auth middleware in front.
Endpoint
PUT /api/providers/rest
Content-Type: application/json | application/yaml | application/toml
<dynamic.Configuration body>The body is parsed and forwarded to the watcher. The response is 200 OK with the parsed configuration echoed back.
Behavior
sequenceDiagram
participant C as Client
participant API as Traefik internal entry point
participant P as REST provider
participant W as Configuration watcher
C->>API: PUT /api/providers/rest (body)
API->>P: handle request
P->>P: parse body
P-->>API: 200 OK + parsed
P->>W: dynamic.MessageUse cases
- Custom controllers that compute configuration in-process and push to Traefik.
- CLI tooling for ad-hoc routes during development.
- Smoke testing the entire configuration apply path.
Tests
integration/rest_test.gocovers the full push path.
Practical notes
- The pushed configuration is volatile. It does not persist across restarts.
- Pushing is the entire surface — there is no DELETE endpoint, no per-route operations. To remove a router, push a new configuration without it.
- Combine with another provider to seed initial state; the REST provider is most useful as an overlay on top of file or KV providers.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.