How to setting up Failure Mode for route using API?

Hi you all,
as you know when adding a new route from the web interface you can choose two failure modes: fail closed or fail open.

Is there a way to specify the failure mode to use when creating a new route via API? Or a way to change it after the route creation?

Regards

2 Likes

No way?

A bit late, but I found that when I send {request_limit_fail_open: true} in my json, cloudflare API replies with
{
“result”: {
“id”: “”,
“request_limit_fail_open”: true
},
“success”: true,
“errors”: ,
“messages”:
}

1 Like

I am also looking for the same. Can someone share any appropriate documentation link for same? Is it possible to set the failure mode to Open in the worker code?

Did you try the parameter from the response before you?

You’d likely just include it as another parameter, similar to pattern and script, using this API route: Cloudflare API v4 Documentation

I do not think if that is useful. Also, I couldn’t find anything in the documentation. Can you kindly direct me to the direct link of what you’re referring to from the documentation?

I have sent you the documentation of the route you should try it on and how it would be used - it isn’t documented directly.

I think it would be helpful too if there is some code I may rather add to worker JS, as when it hits the limit, it may start the bypass. event.passThroughOnException() somewhat does that probably but I need more information on that.