Redirect traffic if site is offline?

I want to redirect traffic from an offline site to another url.

Example,

I have a rest api site that is: api.somedomain.com:1234
With no routes, I return a “status” - “ok”

However, when the rest api service is not running or if the server is down, anything but 200 code, I want to redirect it to: api-fallback.somedomain.com

Is the possible with Cloudflare? Thanks!

If it’s not Port 443, it might be difficult to do this. Only the following ports may be :orange: Proxied through Cloudflare unless you’re on an Enterprise Plan with Spectrum:

Yes, this is only for testing purposes. But I would just like to figure out if im able to do a fallback server, unless I use an api on top of it. Check if api.somedomain.com is online then point to it. If not, point to api-fallback.somedomain.com

Another approach would be to script this on a separate server. Do your checks, and if it fails, use the API to make a DNS change. This would be completely independent of its :orange:/:grey: proxy status.

https://api.cloudflare.com/#dns-records-for-a-zone-update-dns-record

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.