bypass workers with cookie

Is there any way to bypass workers using a cookie? For example in the case that something catastrophic is wrong with a worker I'd like to set a cookie and just send traffic directly to the origin.
2 Replies
Chaika
Chaika2mo ago
Not directly, you have a few other options though: 1. You can have your worker handle looking at the cookie first thing it does and just return fetch(request). Less chance of it completely exploding early on 2. You can call context.passThroughOnException(), which will pass through to the origin on an exception https://developers.cloudflare.com/workers/runtime-apis/handlers/fetch/ Please note though that doesn't work in all cases. For example, it's a POST request and your worker already consumed the body, it's gone.
Eezergoode
Eezergoode2mo ago
Okay, thank you for the tips @Chaika !