api7 / envoy-apisix

Apache License 2.0
34 stars 6 forks source link

first goal #1

Open nic-chen opened 4 years ago

nic-chen commented 4 years ago

-- 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
membphis commented 4 years ago
  1. envoy 的纯 lua 实现

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

nic-chen commented 4 years ago

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.