All Projects → api7 → envoy-apisix

api7 / envoy-apisix

Licence: Apache-2.0 License
No description, website, or topics provided.

Programming Languages

lua
6591 projects

About

A Lua framework that support Apache APISIX plugins run directly in Envoy Lua filter without modify Envoy.

Example

  1. clone the code
git clone https://github.com/api7/envoy-apisix.git
  1. build and run the example
$ cd envoy-apisix/example
$ docker-compose pull
$ docker-compose up --build -d
  1. test the example
$ curl 127.0.0.1:8000/foo/root.exe -i

HTTP/1.1 403 Forbidden
server: envoy
content-length: 0
date: Wed, 18 Nov 2020 00:08:54 GMT

Plugins

How does it work

We shield platform differences for the plugin layer. All interfaces that need to be used are abstracted in the underlying framework, which we call apisix.core, so that all plugins can run on Envoy and Apache APISIX at the same time.

Architecture

Plugin workflow

Architecture

We use the example to show how the plugin runs:

First step, read configuration

We configure through metadata to determine what plugins need to run on each route and what configuration is for each plugin. In the example, we configured plugin uri-blocker for the route whose prefix is ​​/foo, as well as the block rule of the plugin and the response status when a block is required.

Second step, parse request

We encapsulated the client request data into ctx so that it can be used directly in the entire process.

Third step, run the plugin

We determine whether we need to block this request by matching the configured rules and the obtained uri. If a block is needed, we call respond to directly respond, otherwise we let it go.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].