envoy-apisix icon indicating copy to clipboard operation
envoy-apisix copied to clipboard

first goal

Open nic-chen opened this issue 5 years ago • 2 comments

-- 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(...)

nic-chen avatar Sep 16 '20 07:09 nic-chen

  1. envoy 的纯 lua 实现

we need to implement this step first, we can step by step.

membphis avatar Sep 16 '20 08:09 membphis

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.

nic-chen avatar Sep 17 '20 13:09 nic-chen