OpenResty Edge automatically health-checks your gateway servers — the load balancer nodes themselves, not the upstream backends. Each node is probed over HTTP at a configurable interval. When a node fails the check, OpenResty Edge removes its IP from DNS resolution and the distributed SSL session cache, and restores it automatically once the node recovers.

This failover happens at the DNS level, the same layer where global server load balancing makes its routing decisions. In this tutorial, we create a health check endpoint with a page rule, enable health checks for a gateway cluster, and verify that a stopped node is taken out of rotation.

Create a Health Check Endpoint with a Page Rule

Open the web console. This is our sample deployment of the console. Every user would have their own deployment.

Gateway Clusters page in the OpenResty Edge Admin console

First, go to the “Applications” tab.

Applications tab in the OpenResty Edge Admin console

We pre-prepared an application named “test-edge.com”.

HTTP/HTTPS applications list in the OpenResty Edge console

Click to configure this application.

Configure button for the test-edge.com application

Go to “Page Rules” page.

test-edge.com application settings page with Page Rules highlighted in the sidebar

Here, we can add a new rule.

New Rule button on the Page Rules page

For this page rule, we need to specify a condition.

New Rule dialog with the “Enable when” condition toggle

Enter “/status” as the value of string.

Page rule condition editor with Variable URI and the Prefix matches operator

Let’s add a new action.

Add action panel in the page rule editor

Select the “output response body”.

Action type dropdown listing the available page rule actions

Set the response body as “healthy”. When the requested URI is “/status”, the response body “healthy” will be output.

Response body set to healthy for requests to /status

After clicking the “Create” button to create the rule, we need to make a new release to push out our new changes.

Pending changes ready for a new release in OpenResty Edge

Click on this button.

Releases page with the “Release the 1 pending change” button highlighted

Ship it!

Release confirmation dialog with the Release button

Our new release is now synchronized to all our gateway servers.

Release synchronized to all gateway servers

Enable Health Checks for Gateway Servers

Let’s go to the gateways clusters page again.

Releases page with the Gateway Clusters top navigation tab highlighted

This is the cluster we are going to use today.

Gateway cluster selected for enabling health checks

Click to copy the IP address.

Copy button for the gateway server IP address

On the terminal, we use the curl command to send a request to the gateway server.

curl request to the gateway server’s /status health check endpoint

We can see the response body is “healthy” indeed.

curl output showing the response body healthy

Click to change the configuration of this cluster, then enable the health check.

Health Check options in the gateway cluster settings, with “Using the Partition configuration” selected

We use the HTTP protocol.

Protocol dropdown in the gateway health check settings, currently showing TCP before selecting HTTP

Set the HTTP Request Host as our application’s name.

HTTP request Host field set to the application name test-edge.com

Enter “/status” as the request URI.

Health check request URI set to /status

Requires the response body to be matched as “healthy”.

Health check configured to require the response body healthy

We set the request interval to be smaller, 3 seconds for demonstration purposes.

Health check request interval set to 3 seconds

Finally, save these settings.

Test Failover: What Happens When a Gateway Node Fails

Switch to the terminal. Let’s stop the server first.

Stopping the gateway server service from the terminal

The service is inactive now.

systemctl status showing the gateway service inactive

After refreshing the table, we can see that the current status of this node is already in red, indicating that it is offline. The node’s IP is removed from DNS resolution and from the distributed cache for SSL session IDs. This is DNS-level failover: new clients are simply no longer directed to the failed node. You can see how these routing decisions are made in OpenResty Edge’s GSLB configuration.

Failed gateway node shown in red and removed from DNS resolution

Check the “Details”.

Details link for the offline gateway node

By clicking on the red block, we can see the details of the failure.

Health check failure details opened from the red status block

Error message showing why the gateway health check failed

After closing the details, restart the gateway server service.

Restarting the gateway server service from the terminal

The server is back up.

systemctl status showing the gateway service active again

Refresh the table again. We can see that the node status has changed back to green.

Recovered gateway node shown in green in the servers table

In addition, we can also enable health checks for all the gateway clusters and servers in a particular partition.

Gateway Clusters page with the Gateway Partitions link highlighted in the sidebar

Click to edit this partition.

Edit button for a gateway partition

We can enable the health check by this button.

Health check toggle enabling checks for all clusters in a partition

The health checks here are for the gateway servers themselves, not for upstream backend servers or origin servers — those are a separate OpenResty Edge feature.

Gateway Network Partitions list in the OpenResty Edge console

Frequently Asked Questions

How do I health check the load balancer itself?

In OpenResty Edge, enable health checks in the gateway cluster or partition settings. Each gateway node — the load balancer itself — is probed over HTTP: you set the request Host, a URI such as “/status”, the expected response body, and the probe interval. Nodes that fail the check are taken out of DNS rotation automatically.

What happens when a gateway node fails the health check?

Its status turns red in the gateway servers table, and its IP address is removed from DNS resolution and from the distributed cache for SSL session IDs, so no new traffic is routed to it. You can inspect the failure details from the console. Once the node passes the checks again, it turns green and returns to rotation automatically.

Is this the same as upstream (backend) health checks?

No. The health checks described here monitor the gateway servers themselves — the nodes that receive client traffic. Health checks for upstream backend servers or origin servers are a separate OpenResty Edge feature.

What can the health check probe?

The probe is an HTTP request with a configurable request Host, request URI, expected response body match, and interval (3 seconds in this demo). Combined with a page rule that outputs a fixed body such as “healthy”, every gateway node can expose a lightweight health check endpoint without involving any backend.

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.