OpenResty Edge lets you set up a reverse proxy and load balancer entirely from its Admin web console — no server reload, restart, or binary upgrade required. This tutorial walks the full round trip: create an application, define an upstream pointing at your backend, wire a page rule with a round-robin policy, release the config to every gateway node, and verify with curl.

OpenResty Edge reverse proxy and load balancer overview

Create a Sample Application in the Edge Admin Console

We manage all the gateway server nodes and their configurations in a central place, the Edge Admin web console.

OpenResty Edge Admin console for managing gateway nodes and configuration

Let’s go to a web console of OpenResty Edge. This is our sample deployment of the console. Every user would have their own deployment.

Let’s login using our user name and password.

OpenResty Edge Admin login page

Other authentication methods are also configurable.

Sign in now.

Signing in to the OpenResty Edge Admin console

We’re now at the application list page. There are many existing applications we created previously. Each application is like a virtual host or virtual server in the same gateway.

Here we’d create a new application.

Application list page in the Edge Admin console

We will just create one of the HTTP type. It is the default.

Creating a new HTTP application in OpenResty Edge

We assign a single domain, test-edge.com, to this application.

Assigning the test-edge.com domain to the new application

We may add more domains, including wildcard domains.

Adding additional domains including wildcards to the application

We only care about the 80 port in this example.

Setting port 80 for the HTTP application

Let’s create this application!

Confirming creation of the new HTTP application

Now we are inside this new application. It’s empty.

Add a Reverse Proxy Upstream for Your Backend

Let’s go to the Upstreams page.

Upstreams page inside the new Edge application

Obviously, we currently have no upstreams defined.

Create a new upstream for our backend servers.

Creating a new upstream for the backend server

We give this upstream a name, say, my_backend.

Naming the reverse proxy upstream my_backend

For simplicity, we just use the HTTP protocol here.

Choosing HTTP protocol for the upstream

We may always want to use HTTPS for the real thing.

Option to switch the upstream to HTTPS

Here we need the backend server’s IP address.

Backend server IP address field for the upstream

We’ve already prepared a sample backend server at this IP address.

Sample backend server that returns the default OpenResty index page

It simply returns the default index page of the open source OpenResty server software.

It could be anything that speaks HTTP.

Diagram: OpenResty Edge can reverse-proxy to any HTTP backend

We can now fill out the host field for the backend server.

Filling in the backend server host in the upstream form

We keep the 80 port intact.

Keeping port 80 for the upstream backend

We may add more servers to this upstream in the future.

Adding additional backend servers to the upstream

Now save this upstream.

Saving the my_backend upstream

We can see this my_backend upstream is already there.

The my_backend upstream listed on the Upstreams page

Add a Round-Robin Page Rule for the Upstream

Now let’s create a new page rule to actually make use of this upstream.

Page Rules page inside the Edge application

We currently don’t have any page rules defined.

Create a new page rule.

Creating a new page rule

For this page rule, we do not specify a condition. This way it will apply to all incoming requests.

Page rule with no condition, applying to all incoming requests

We could, however, limit this proxy page rule to certain requests only.

Optional condition to limit the reverse proxy page rule to specific requests

We disable the condition again.

Disabling the page rule condition

Let’s add a proxy target here.

Adding a proxy target to the page rule

Let’s choose an upstream.

Choosing an upstream as the proxy target

Here we have our newly created upstream present.

The newly created my_backend upstream available for selection

We also have some pre-defined global upstreams. They can be reused by all the applications including this one.

Pre-defined global upstreams reusable across applications

We select our my_backend upstream.

Selecting the my_backend upstream as the proxy target

Our upstream has only one server.

So the balancing policy does not really matter here.

Load-balancing policy selection for the upstream (round robin default)

We’d just keep the default round robin policy.

We may also want to enable caching of the responses. We’ll cover this topic in another video.

Optional response caching for the reverse proxy page rule

Finally, create this rule for real.

Creating the reverse proxy page rule

We can see the proxy page rule is already listed on the page rule list.

The new reverse proxy page rule listed on the Page Rules page

Release the Reverse Proxy Config to Every Gateway Node

The last step is to make a new configuration release. It will push out our pending changes to all our gateway servers.

Pending configuration changes ready for release

Let’s click on this link to make a new release.

Starting a new configuration release

We have a chance to review our changes before pushing them out.

This is our first change.

Reviewing the first pending change before release

It is our addition of the my_backend upstream.

Diff showing the addition of the my_backend upstream

This is our second change.

Reviewing the second pending change before release

Diff showing the new reverse proxy page rule

This is indeed our proxy page rule.

Now we make a release to all our gateway servers.

Releasing the reverse proxy config to every gateway server

Ship it!

Confirming the config release

We can watch the configuration synchronization progress at real time. It is pushed out to the whole gateway network.

Real-time configuration synchronization progress across the gateway network

Now it is fully synchronized. As we can see, this sample deployment has 13 servers in the gateway network.

We do incremental config synchronization across the whole network.

We live-update config on the request level. None of the application-level configuration changes require server reload, restart, or binary upgrade. So it is very scalable even when you have many different users making frequent releases.

Diagram: incremental, request-level config sync across the OpenResty Edge gateway network

We can also check all the gateway servers grouped by clusters.

Gateway servers grouped by cluster in the Edge Admin console

This is just our sample deployment around the world.

Sample OpenResty Edge deployment with gateway nodes worldwide

Our users are free to deploy their gateway servers anywhere they like. Or spanning different clouds and hosting services.

Diagram: OpenResty Edge gateway nodes across multiple clouds and regions

This column shows the configuration synchronization status for each gateway server.

Per-node configuration synchronization status column

We can test a gateway server near San Francisco here.

Testing a gateway server near San Francisco

Its public IP address is this.

Public IP address of the San Francisco gateway node

We copy this IP address to test this server directly.

On the terminal, we can use curl to test this San Francisco gateway server.

curl -sS -H 'Host: test-edge.com' 'http://138.68.231.133/' | less

curl command targeting the San Francisco gateway node with a Host header

Note that we specify the Host request header. This is because the same server is serving many different virtual hosts.

Send the request.

curl response showing the default OpenResty index page proxied through Edge

It works as expected! We got the default OpenResty index page just like accessing the backend server directly.

We can check the response header too via the -I option of curl.

curl -I -H 'Host: test-edge.com' 'http://138.68.231.133/'

Response headers returned by the OpenResty Edge gateway

There are some headers created by the OpenResty Edge gateway software.

Alternatively, we could bind the IP address to the host name in this local /etc/hosts file. Then we’ll be able to point a web browser to this domain directly.

cat /etc/hosts

Local /etc/hosts file mapping test-edge.com to the gateway node IP

For the real setup, we should add the gateway server IP addresses to our DNS name servers.

dig test-edge.com

Here we haven’t configured this domain’s DNS records yet. We’ll demonstrate it in another video.

dig test-edge.com output showing no DNS records configured yet

OpenResty Edge can also work as an authoritative DNS server network at the same time.

OpenResty Edge can also serve as an authoritative DNS network

This is optional though. The user could still choose to use 3rd-party DNS name servers. This is what I’d like to cover today.

Using third-party DNS servers with OpenResty Edge is optional

FAQ

How do you set up a reverse proxy in OpenResty Edge from the Admin web console?

Create an application (a virtual host), add an upstream with your backend’s IP and port, add a page rule that proxies traffic to that upstream, then release. No server reload, restart, or binary upgrade is required.

What is an upstream in OpenResty Edge?

An upstream is a named group of backend servers your reverse proxy sends traffic to. In this tutorial we create my_backend with a single backend on port 80, but you can add more servers later and Edge will load-balance across them.

How does OpenResty Edge push a new reverse proxy config to every gateway node?

After creating the application, upstream, and page rule, click Release. Edge does incremental, request-level config synchronization across the whole gateway network — no reload, restart, or binary upgrade. In the sample deployment shown here, the release propagates to all 13 gateway servers.

How do I test that the reverse proxy is working?

Point curl at any gateway node’s public IP with the application’s Host header, e.g. curl -sS -H 'Host: test-edge.com' 'http://<node-ip>/'. You should see the same response the backend serves directly — in this tutorial, the default OpenResty index page.

Learn how global server load balancing (GSLB) distributes traffic across regions, keep user sessions on the same backend with a sticky cookie, or proxy TCP services without editing nginx config.

What is OpenResty Edge

OpenResty Edge is our all-in-one gateway software for microservices and distributed traffic architectures. It combines traffic management, private CDN construction, API gateway, security, and more to help you easily build, manage, and protect modern applications. OpenResty Edge delivers industry-leading performance and scalability to meet the demanding needs of high concurrency, high load scenarios. It supports scheduling containerized application traffic such as K8s and manages massive domains, making it easy to meet the needs of large websites and complex applications.

If you like this tutorial, please subscribe to this blog site and/or our YouTube channel. Thank you!

About The Author

Yichun Zhang (Github handle: agentzh), is the original creator of the OpenResty® open-source project and the CEO of OpenResty Inc..

Yichun is one of the earliest advocates and leaders of “open-source technology”. He worked at many internationally renowned tech companies, such as Cloudflare, Yahoo!. He is a pioneer of “edge computing”, “dynamic tracing” and “machine coding”, with over 22 years of programming and 16 years of open source experience. Yichun is well-known in the open-source space as the project leader of OpenResty®, adopted by more than 40 million global website domains.

OpenResty Inc., the enterprise software start-up founded by Yichun in 2017, has customers from some of the biggest companies in the world. Its flagship product, OpenResty XRay, is a non-invasive profiling and troubleshooting tool that significantly enhances and utilizes dynamic tracing technology. And its OpenResty Edge product is a powerful distributed traffic management and private CDN software product.

As an avid open-source contributor, Yichun has contributed more than a million lines of code to numerous open-source projects, including Linux kernel, Nginx, LuaJIT, GDB, SystemTap, LLVM, Perl, etc. He has also authored more than 60 open-source software libraries.