← back

Traefik WASM Plugins: Write Middleware in Any Language

Dec 4, 2025

traefikwasmwebassemblyproxymiddleware

Traefik Proxy v3 introduced WebAssembly (WASM) plugin support, allowing you to write middleware in languages beyond Go—including Rust, C/C++, and JavaScript. This is a major leap from the previous Yaegi-only approach.

Why WASM over Yaegi?

Before v3, Traefik plugins required Go code interpreted by Yaegi, an embedded Go interpreter. While convenient (no compilation needed), Yaegi has limitations:

WASM plugins solve all of these:

AspectYaegiWASM
PerformanceInterpretedNear-native
LanguagesGo onlyGo, Rust, C, JS, etc.
SecurityRuns in processSandboxed isolation
External depsNot supportedLanguage-dependent

Security: The Sandbox Advantage

WASM plugins run in a sandboxed environment, isolated from the core Traefik process. Even if a plugin contains vulnerable or malicious code, it cannot directly compromise Traefik itself. This is a significant security improvement over Yaegi plugins, which run in the same process.

Configuration Example

Static config (declare the plugin):

experimental:
  plugins:
    example:
      moduleName: github.com/traefik/plugindemowasm
      version: v0.0.1

Dynamic config (apply as middleware):

http:
  middlewares:
    my-plugin:
      plugin:
        example:
          headers:
            Foo: Bar

Real-World Use Case: Coraza WAF

Traefik v3 shipped with its first official WASM plugin: Coraza WAF, an open-source Web Application Firewall. It demonstrates the power of WASM—running complex security logic at near-native speed within Traefik’s request pipeline.

Development Workflow

  1. Write your plugin in Go (using TinyGo to compile to WASM) or Rust
  2. Compile to plugin.wasm
  3. Create a .traefik.yml manifest
  4. Test locally in ./plugins-local/src/github.com/[org]/[name]/
  5. Publish to GitHub with the traefik-plugin topic for catalog discovery

Key Takeaways

The shift from interpreted to compiled plugins mirrors what we’re seeing across the industry—WASM is becoming the universal runtime for extensibility.