Configure Cloudflare Worker as Health Canaries

We want to know immediately when the servers are not functioning or API servers break down. We can do this easily by setting up the healthchecks in CloudFlare.

It alows us to send health checks pings to the destination URLs and you can also specify the expected HTTP code, or the target response text. This is a quick way to write a test – also known as the Canaries.

cloudflare-health-checks-canaries Configure Cloudflare Worker as Health Canaries API Architecture

Then from server logs, you can see:

[27/Mar/2021:19:03:01 +0000] “GET /api/merger/query/ HTTP/1.1” 200 372 “-” “Mozilla/5.0 (compatible;Cloudflare-Healthchecks/1.0;+; healthcheck-id: 2f2501de83eeaf85)”

You will be notified by email (sent from [email protected]) in case of any errors:

Health check status changed

2021-03-25 08:10:25 +0000 UTC | Down | Response code mismatch error | helloacm-api

Expected code: [200]

Received code: 522

To unsubscribe, please edit your Cloudflare Healthchecks notification settings.

Cloudflare, Inc. · 101 Townsend Street · San Francisco, CA 94107 · USA

AMP Version This post has 197 words.

Leave a Reply

Your email address will not be published. Required fields are marked *