This library is under construction.
A Nginx module which tries to implement proxy wasm ABI in Nginx.
- Download the wasmtime C API package and rename it to
wasmtime-c-api/
, with the./install-wasmtime.sh
. Remember to add thewasmtime-c-api/lib
to the library search path when you build Nginx, for instance,
export wasm_prefix=/path/to/wasm-nginx-module/wasmtime-c-api
./configure ... \
--with-ld-opt="-Wl,-rpath,${wasm_prefix}/lib" \
syntax: wasm_vm wasmtime
default: -
context: http
Select the WASM VM. Currently, only wasmtime is supported. If the directive is not set, the WASM VM won't be enabled.
Remember to set the wasm_vm
directive!
syntax: plugin, err = proxy_wasm.load(path)
Load a .wasm
file from the filesystem and return a WASM plugin.
local plugin, err = proxy_wasm.load("t/testdata/plugin_lifecycle/main.go.wasm")
syntax: plugin_ctx, err = proxy_wasm.on_configure(plugin, conf)
Create a plugin ctx with the given plugin and conf.
local plugin, err = proxy_wasm.load("t/testdata/plugin_lifecycle/main.go.wasm")
if not plugin then
ngx.log(ngx.ERR, "failed to load wasm ", err)
return
end
local ctx, err = wasm.on_configure(plugin, '{"body":512}')
if not ctx then
ngx.log(ngx.ERR, "failed to create plugin ctx ", err)
return
end
syntax: ok, err = proxy_wasm.on_http_request_headers(plugin_ctx)
Run the HTTP request headers filter in the plugin of the given plugin ctx.
local plugin, err = proxy_wasm.load("t/testdata/plugin_lifecycle/main.go.wasm")
if not plugin then
ngx.log(ngx.ERR, "failed to load wasm ", err)
return
end
local ctx, err = wasm.on_configure(plugin, '{"body":512}')
if not ctx then
ngx.log(ngx.ERR, "failed to create plugin ctx ", err)
return
end
assert(wasm.on_http_request_headers(ctx))
Implemented proxy-wasm ABI can be found in proxy_wasm_abi.