I followed this guide:
But have yet to manage to get it work. All the requests to workers end up being handled by Cloudflare Pages. For example:
When I removed the CNAME record used by subdomain.example.com that points to Cloudflare pages, the worker worked. But Cloudflare pages obviously did not work afterwards.