WASM Plugins
WASM Plugins are reusable WebAssembly plugin configurations that can be referenced by multiple routes. Instead of configuring WASM settings inline on each route, you can create a WASM plugin entity and reference it by ID, making it easier to manage and share WASM logic across your infrastructure.
UI page
You can find all WASM plugins here
Properties
id: unique identifier of the WASM pluginname: display name of the plugindescription: description of the plugintags: list of tags associated to the pluginmetadata: list of metadata associated to the pluginsteps: the list of proxy engine steps where this plugin will be applied (see below)config: the WASM plugin configuration (see below)
Steps
The steps field defines at which points in the proxy engine pipeline this WASM plugin can be used:
MatchRoute: custom route matching logicRouter: custom routing decisionSink: handle requests that don’t match any routePreRoute: request enrichment before routingValidateAccess: access control validationTransformRequest: modify the request before forwarding to backendTransformResponse: modify the response before sending to clientHandlesRequest: handle the complete request/response lifecycle (acts as a backend)CallBackend: custom backend call logicHandlesTunnel: handle tunnel connectionsJob: periodic job execution
Configuration
source: the WASM source definition (see source types below)memoryPages: number of memory pages allocated to the WASM VM (default: 50)functionName: the name of the function to invoke in the WASM module (optional, defaults to the step-specific function name)config: a key-value map of configuration passed to the WASM plugin at runtimeinstances: number of concurrent WASM VM instances (default: 1)wasi: enable WebAssembly System Interface support (default: false)opa: enable Open Policy Agent mode for policy evaluation (default: false)httpWasm: enable HTTP WASM mode (default: false)allowedHosts: list of hostnames the WASM plugin is allowed to call via HTTPallowedPaths: map of file paths the WASM plugin is allowed to accesskillOptions: VM termination options for resource managementauthorizations: fine-grained access control for the WASM plugin (see below)
Source types
The source field defines where the WASM module is loaded from:
base64: the WASM binary encoded as a base64 stringfile: a local file path pointing to a.wasmfilehttp: an HTTP/HTTPS URL to download the WASM module fromwasmo: a reference to a WASM module compiled and managed by a Wasmo instancelocal: a reference to another WASM plugin entity by ID
Authorizations
The authorizations field controls what the WASM plugin is allowed to access at runtime:
httpAccess: allow the plugin to make outbound HTTP calls (default: false)proxyHttpCallTimeout: timeout in milliseconds for HTTP calls made by the plugin (default: 5000)globalDataStoreAccess: read/write rights to the global persistent key-value storepluginDataStoreAccess: read/write rights to the plugin-scoped persistent key-value storeglobalMapAccess: read/write rights to the global in-memory storepluginMapAccess: read/write rights to the plugin-scoped in-memory storeproxyStateAccess: allow reading the current Otoroshi proxy state (default: false)configurationAccess: allow reading the Otoroshi configuration (default: false)
Each data store access is defined as { "read": true/false, "write": true/false }.
Learn more
For a detailed overview of WASM in Otoroshi, available plugin types, and how they integrate with the proxy engine, see Otoroshi and WASM.
For practical guides:
- Install a Wasmo to set up a Wasmo instance for compiling WASM plugins
- Use a WASM plugin for a step-by-step tutorial on creating and using WASM plugins