This tutorial will show you how to OpenResty Edge How to configure webhooks in. Webhooks can be triggered when an event you are concerned about occurs, such as an offline event of the gateway server. After that, Edge Admin will automatically send an HTTP request to your customized HTTP API.

 Embeded image

Create a webhook in OpenResty Edge Admin

Let's go OpenResty Edge Web console for. This is a sample deployment of our console. Each user has its own local deployment.

Screenshot

First, we need to create a webhook. Enter the "Global Config" page.

Screenshot

Select Webhooks.

Screenshot

Create a webhook.

Screenshot

Here we have created a webhook, which is used to send HTTP requests to the user's own implemented API when the gateway server is offline.

Screenshot

There are many built-in events for you to choose from. We can also add more events according to your needs.

Screenshot

Here we select the "Gateway Server Offline" event.

Screenshot

After clicking "Create", the new webhook is added.

Screenshot

Trigger this webhook

To trigger this webhook, let's set a gateway server offline.

Screenshot

Use this server.

Screenshot

Open the settings page.

Screenshot

Please note that this server is now online.

Screenshot

Set it offline.

Screenshot

preservation.

Screenshot

View the execution history of webhook

Now let's go to the webhooks page to view the execution history.

Screenshot

Select Webhooks.

Screenshot

Click the "Details" button.

Screenshot

You can see the execution history of the webhook, indicating that the triggered event has been successfully sent.

Screenshot

Gateway Server Offline events also include offline events caused by server failures or other exceptions, not just the active logoff marking in Edge Admin as demonstrated here.

If you like this tutorial, please subscribe to this blog site and our YouTube Channel or Station B channel thank you!

About the author

Zhang Yichun is open source OpenResty ® Project founder and OpenResty Inc. CEO and founder of the company.

Zhang Yichun (Github ID: agentzh) was born in Jiangsu, China, and now lives in the U.S. Bay Area. He was an advocate and leader of China's early open source technology and culture, and once worked for many internationally renowned high-tech enterprises, such as Cloudflare Yahoo, Alibaba, the pioneer of "edge computing", "dynamic tracking" and "machine programming", has more than 22 years of programming and 16 years of open source experience. As the leader of open source projects with more than 40 million global domain name users, he OpenResty ® High tech enterprises created by open source projects OpenResty Inc. It is located in the center of Silicon Valley in the United States. Its two main products OpenResty XRay (Utilize Dynamic tracking Technology) and OpenResty Edge (The all-purpose gateway software most suitable for microservices and distributed traffic), widely favored by many listed and large enterprises worldwide. Besides OpenResty, Zhang Yichun has contributed more than one million lines of code to many open source projects, including Linux kernel, Nginx LuaJIT GDB SystemTap LLVM , Perl, etc., and has written more than 60 open source software libraries.

Follow us

If you like this article, please follow us OpenResty Inc. Corporate Blog Site You are also welcome to scan our WeChat official account:

Our

translate

We provide English version Original text and Chinese translation (this article). We also welcome readers to provide translations in other languages. As long as the full text translation is not omitted, we will consider using it. Thank you very much!