Documentation Index
Fetch the complete documentation index at: https://mintlify.com/traefik/traefik/llms.txt
Use this file to discover all available pages before exploring further.
Plugins Overview
Traefik’s plugin system allows you to extend its capabilities with custom middleware and provider plugins. Plugins are dynamically loaded and can be written in Go (using Yaegi interpreter) or WebAssembly (Wasm), providing a flexible way to add custom functionality without modifying Traefik’s core codebase.Plugin Architecture
Traefik supports two types of plugins:- Middleware Plugins - Extend request/response processing
- Provider Plugins - Integrate custom configuration sources
- Yaegi - Go interpreter for running Go code dynamically (default)
- WebAssembly (Wasm) - Sandbox environment for Wasm modules
The plugin system is part of Traefik’s experimental features and provides a powerful way to customize Traefik’s behavior without forking or modifying the source code.
Plugin Types
Middleware Plugins
Middleware plugins allow you to process HTTP requests and responses. They can:- Modify request headers
- Transform request/response bodies
- Implement custom authentication logic
- Add rate limiting or throttling
- Perform custom logging and metrics
Provider Plugins
Provider plugins enable integration with custom configuration sources. They can:- Fetch configuration from custom APIs
- Integrate with proprietary service discovery systems
- Generate dynamic routing rules
- Connect to custom databases or configuration stores
Plugin Sources
Traefik supports two ways to load plugins:Remote Plugins
Plugins published to the Plugin Catalog are downloaded automatically from GitHub repositories. These plugins are verified and can be installed by specifying the module name and version.
Plugin Manifest
Every plugin must include a.traefik.yml manifest file at its root. This file describes the plugin’s metadata and configuration:
.traefik.yml
Manifest Fields
| Field | Required | Description |
|---|---|---|
displayName | Yes | Human-readable plugin name |
type | Yes | Plugin type: middleware or provider |
runtime | No | Runtime environment: yaegi (default) or wasm |
import | Yes* | Go import path (Yaegi plugins only) |
basePkg | No | Base package name (defaults to last path component) |
wasmPath | No | Path to .wasm file (Wasm plugins, defaults to plugin.wasm) |
summary | Yes | Short description of the plugin |
useUnsafe | No | Whether plugin uses unsafe/syscall packages |
testData | Yes | Sample configuration for testing |
Plugin Lifecycle
Installation Process
Configuration
Plugin is defined in Traefik’s static configuration under
experimental.plugins (remote) or experimental.localPlugins (local).Download & Validation
Remote plugins are downloaded from their GitHub repository. The module name and version are validated, and the archive hash is optionally checked.
Extraction
Plugin archive is extracted to the sources directory. The manifest file is read and validated.
Builder Creation
A plugin builder is created based on the runtime type (Yaegi or Wasm). For Yaegi plugins, an interpreter is initialized.
Middleware Plugin Lifecycle
- Builder Creation - Plugin builder is created during Traefik startup
- Configuration - Dynamic configuration references the plugin
- Instantiation -
CreateConfig()andNew()functions are called - Request Handling - Plugin processes HTTP requests
- Cleanup - Handler is garbage collected when no longer needed
Provider Plugin Lifecycle
- Initialization -
Init()is called when provider starts - Configuration -
Provide()is called to start configuration stream - Updates - Provider sends configuration updates via channel
- Shutdown -
Stop()is called during Traefik shutdown
Plugin Storage
Traefik organizes plugin files in the following structure:Runtime Comparison
| Feature | Yaegi | WebAssembly |
|---|---|---|
| Language | Go only | Any Wasm-compatible language |
| Performance | Native Go performance | Near-native with slight overhead |
| Sandboxing | Limited (Go interpreter) | Strong isolation |
| Plugin Types | Middleware & Provider | Middleware only |
| Unsafe/Syscall | Optional (via settings) | Not available |
| File System Access | Full access | Configurable mounts |
| Environment Variables | Full access | Configurable forwarding |
| Development | Easier (pure Go) | Requires Wasm toolchain |
Plugin Interfaces
Middleware Interface (Yaegi)
Provider Interface (Yaegi)
Configuration Options
Remote Plugin Settings
Local Plugin Settings
Abort on Plugin Failure
Plugin Catalog
The Traefik Plugin Catalog is a centralized repository of community and official plugins. Benefits include:- Discovery - Browse available plugins by category
- Verification - Plugins are reviewed and tested
- Installation - Direct installation instructions
- Documentation - Plugin-specific documentation and examples
- Ratings - Community feedback and ratings
You can access the Plugin Catalog directly from the Traefik Dashboard via the “Plugins” menu entry.
Best Practices
Performance
- Keep plugin logic lightweight and efficient
- Avoid blocking operations in request handlers
- Use caching where appropriate
- Monitor plugin performance impact
Security
- Review plugin source code before installation
- Use specific version tags, not
latestor branches - Enable
hashverification for production deployments - Minimize use of
useUnsafesetting - Restrict Wasm plugin file system access
Development
- Test plugins locally before publishing
- Provide comprehensive test data in manifest
- Follow semantic versioning
- Document configuration options clearly
- Include examples in plugin repository
Maintenance
- Keep plugins updated to latest versions
- Monitor plugin compatibility with Traefik versions
- Check plugin logs for errors or warnings
- Clean old plugin versions from archives
Troubleshooting
Plugin Not Loading
Hash Verification Failures
Unsafe Package Errors
Next Steps
Using Plugins
Learn how to install and configure plugins in your Traefik instance
Plugin Catalog
Browse the official catalog of available Traefik plugins
Create Plugins
Developer guide for building your own Traefik plugins
Middleware Overview
Learn about Traefik’s built-in middleware system