2 cloudflare apps conflict + page rule (disable apps) doesn't work


I developed 2 Cloudflare apps that uses workers to alter contents of a page. Both workers are set to handle requests for a subdomain (subdomain.example.com).

The problem is: the root domain (example.com) becomes stuck at loading when BOTH apps are installed.

  1. it works when only 1 of the apps is installed.
  2. how come it affected how the root domain loads when the worker only handles requests to the subdomain?
  3. I have tried adding a page rule “disable apps” for the root domain, but the “stuck on loading” page problem is still there. The page rule doesn’t seem to take effect - i tried this by adding a “disable apps” page rule for the subdomain where the cf apps run, and the app still makes changes to the content.

Even updating both apps (workers) to only do

addEventListener("fetch", event => {

still bugs the root domain.

Found a fix. I had to return a cloned response. I don’t understand why returning fetch directly doesn’t work.

This works:

addEventListener("fetch", event => {
event.respondWith(fetch(event.request).then(x => x.clone()));