代码拉取完成,页面将自动刷新
title |
---|
WASM |
APISIX supports WASM plugins written with Proxy WASM SDK.
This plugin requires APISIX to run on APISIX-OpenResty, and is under construction. Currently, only a few APIs are implemented. Please follow wasm-nginx-module to know the progress.
The plugin supports the follwing concepts from Proxy WASM:
Wasm Virtual Machine
┌────────────────────────────────────────────────────────────────┐
│ Your Plugin │
│ │ │
│ │ 1: 1 │
│ │ 1: N │
│ VMContext ────────── PluginContext │
│ ╲ 1: N │
│ ╲ │
│ ╲ HttpContext │
│ (Http stream) │
└────────────────────────────────────────────────────────────────┘
First of all, we need to define the plugin in config.yaml
:
wasm:
plugins:
- name: wasm_log # the name of the plugin
priority: 7999 # priority
file: t/wasm/log/main.go.wasm # the path of `.wasm` file
That's all. Now you can use the wasm plugin as a regular plugin.
For example, enable this plugin on the specified route:
curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "/index.html",
"plugins": {
"wasm_log": {
"conf": "blahblah"
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:1980": 1
}
}
}'
Attributes below can be configured in the plugin:
Name | Type | Requirement | Default | Valid | Description |
---|---|---|---|---|---|
conf | string | required | the plugin ctx configuration which can be fetched via Proxy WASM SDK |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。