Back to Home
Question 3: Workers not applied
Customer Inquiry
Subject: Workers not applied
I've just added a Worker on the Cloudflare Dashboard for my website: it works in the debugger but doesn't work when I query the site. Why is that? Is there anything to activate or anything I could check?
Response to Customer
Hello,
Thank you for contacting Cloudflare Support.
I understand you've created a Cloudflare Worker that is functioning correctly in the dashboard's debugger, but it's not running on your live site. That's a common situation, and it's usually caused by the Worker not being associated with a specific traffic route.
For a Worker to execute, you need to assign it to a "Route". A Route is a pattern that matches incoming requests and triggers the assigned Worker. Could you please check the "Routes" tab for your Worker in the Cloudflare dashboard to ensure you have a route configured for your website?
A common route pattern to cover an entire site would be *example.com/*. This will trigger the worker on all requests to example.com and its subdomains.
Please check your routes and let me know if that resolves the issue. If not, I'm here to help you investigate further.
Best regards,
João Estêvão
Customer Support Engineer
Cloudflare
Thought Process
- Identify the Core Problem:
- The key information is "works in the debugger but not on the site". This almost always means the Worker is not being triggered. The most common reason for this is a missing or incorrect route.
- Provide a Direct Solution:
- Instead of asking a lot of questions, I can provide the most likely solution directly: check the Worker's routes. This is a simple, actionable step the customer can take immediately.
Tools I Would Use
- Internal Cloudflare Dashboard:
-
- This is the primary tool. I would navigate to the customer's account, go to the Workers section, and check the configuration of their worker.
- Specifically, I would look at the "Routes" tab to see if a route is configured and if the pattern is correct for their intended use case.
- cURL or Browser DevTools:
-
- If a route is configured, I would use `curl` or browser DevTools to make a request to the URL that should be triggering the worker.
- I would check the response for any evidence that the worker has run (e.g., a custom response header, modified HTML, etc.).
- If the worker is supposed to return a specific response and it's not, that tells me the worker is not being invoked.