envoy-apisix
envoy-apisix copied to clipboard
first goal
-- plugin conf:
{
redirect: {
code = 302,
uri = "http://www.baidu.com/search/error.html",
},
}
-- envoy lua code
function envoy_on_request(request_handle) -- request_handle, {envoy.resty = ...}
-- say(package.path)
-- local a6_plugin = require("apisix.plugin")
-- todo: need envoy support, maybe {envoy.resty = ...}
local plugin_conf = {
code = 302,
uri = "http://www.baidu.com/search/error.html",
}
-- a6_plugin.run(request_handle)
request_handle:respond(
{
[":status"] = plugin_conf.code,
["Location"] = plugin_conf.uri
},
"return 302"
)
end
- [x] 1. envoy 的纯 lua 实现
- [x] 2. 确定 package.path
- [ ] 3. 新写 plugin 模块,并尝试加载 require("apisix.plugin")
- [ ] 4. 使用 plugin 方式运行插件,require("apisix.plugin").redirect(...)
- envoy 的纯 lua 实现
we need to implement this step first, we can step by step.
We could implement redirect now. And know how to call a lua package. Next, we could try to implement a APISIx core for envoy to run our plugins.