Worker Not Executing at DNS/End-point Level - Dead in the Water

Hey. As I am learning to use the Workers, it seems to never want to execute at the end-point. I can get a "Hello World" style thing working fine in code view, but when I add a simple script to execute a /rbcheck url to see when it is live on site, it never works. I have @/www full DNS for the domain, I also have routed www. and root with /* - and not doing it in development on mode. In dev console I can see the site is going through CD DNS, and I have waited 24 hours at one point to see if that made a difference with the worker but still nothing. It is testing on a FREE plan, as I wanted to see it work before going deeper. I even tried to whitelist some IPs but still nothing. I am completely lost here. Tried using GPT to advise on CF Workers, as the CF documentation on this is useless on things when it doesn't work. All that simple said the same thing that I had already done. Resulting it a very generic "It must be an issue with the DNS" - Great, soooo... that leaves CF is broken. Doubt that. I have a feeling it is some wierd little toggle somewhere that I need to turn on or off - but again, CF has a million pages with very little user guidance if you are not ultra coder, which I am not at this point. I will post the worker code in the comments as it is too long for here. It is giving a 404 page error on url /rbcheck FYI - it works on a sub test.DOMAIN.com/__rbcheck - just not on apex root and www. Any ideas or guidance would be greatly appreciated. B!
1 Reply
Portalboy
PortalboyOP2mo ago
Here is the worker code that just gives me a 404 on the check url: // RB "Am I Running?" Worker // - For /rbcheck* : returns plain text (unmistakable proof). // - For everything else: forwards to origin but stamps unique headers. export default { async fetch(request) { const url = new URL(request.url); // SLEDGEHAMMER: explicit test path if (url.pathname.startsWith("/rbcheck")) { return new Response("RB Worker LIVE ✅", { status: 200, headers: { "content-type": "text/plain; charset=utf-8", "x-rb-worker": "renderbeam-route", "x-rb-stage": "rbcheck" } }); } // NORMAL: forward to your origin and add unique headers const resp = await fetch(request); const h = new Headers(resp.headers); h.set("x-rb-worker", "renderbeam-route"); h.set("x-rb-stage", "pass-through"); h.set("x-rb-trace", crypto.randomUUID()); // unique per request to prove freshness return new Response(resp.body, { status: resp.status, headers: h }); } }

Did you find this page helpful?