Disabling worker for testing purpose

Hello,

how can I temporarily disable a worker to check if it’s really working on my site. I have modified and used an existing worker Bypass Cache on Cookie.

It seems to be working but I just want to make sure

Hello, would really appreciate if someone could share some thoughts here…

Disabling it entirely would mean removing the route that it’s on - if you want to just skip your Worker’s code itself then add something like:

const url = new URL(request.url);

if (url.searchParams.has('bypassWorker')) {
  return fetch(request);
}

That’d mean that any requests like https://example.com/?bypassWorker would pass through the Worker untouched.

Many thanks, however getting errors when I add your codes. I guess because I already have the following lines

// URL paths to bypass the cache (each pattern is a regex)
const BYPASS_URL_PATTERNS = [
  /\/administrator\/.*/
];

Can you adapt the codes for me assuming I have the following URL that I want to add ?

https://example.com/photos/2158-waterfall-at-7-cascades-surrounded-by-lush-forest

Thanks !