Update .asf.yaml
1 file changed
tree: bf9e1bd7389b153f68bc2743d16e563b730d47fa
  1. .github/
  2. example/
  3. lib/
  4. rockspec/
  5. test/
  6. .asf.yaml
  7. .gitignore
  10. NOTICE
  11. README.md


ShenYu(Incubator) is High-Performance Java API Gateway.

ShenYu Nginx is an Nginx Upstream module for ShenYu instances discovery. The module will discover ShenYu instances to be upstream server of Nginx throght watching register, such as Etcd(supported), Apache Zookeeper(Todo), Nacos(Todo), and others.

Getting Started

  • Prerequisite:
  1. Luarocks
  2. OpenResty

Build from source

The first, clone the source from Github.

git clone https://github.com/apache/incubator-shenyu-nginx

Then, build from source and install.

cd incubator-shenyu-nginx
luarocks make rockspec/shenyu-nginx-main-0.rockspec

Modify the Nginx configure, create and initialize the ShenYu Register to connect to targed register center. Here is an example for Etcd.

init_worker_by_lua_block {
    local register = require("shenyu.register.etcd")
        balancer_type = "chash",
        etcd_base_url = "",
  1. balancer_type specify the balancer. It has supported chash and round robin.
  2. etcd_base_url specify the Etcd server.

Modify the upstream to enable to update upstream servers dynamically. This case will synchorinze the ShenYu instance list with register center. And then pick one up for handling the request.

upstream shenyu {
    server; -- bad 
    balancer_by_lua_block {

Finally, restart OpenResty.

openresty -s reload

Here provides a completed example.

Contributor and Support


Apache License 2.0