Accessing Worker URL from a Worker

Hi All,

Having a weird situation:

  1. Setup a subdomain “data ot example ot come” (CNAME pointing to some other domain - doesn’t matter i guess)
  2. Created a worker which returns some json data
  3. Created a route for the subdomain (“data ot example ot come / *”) and the worker mentioned above.
  4. Tested the worker using the WebUI, and Browser. It works, I can see the JSON output. Tried curl -v as well, everything works.

Now,

  1. Created another subdomain “consumer dot example ot come” (CNAME pointing to some other domain)

  2. Created a worker, which consumes the data ot example ot come URL to fetch the JSON Data
    let data_response = await fetch(new Request("data ot example ot come"))

  3. Worker works fine using the Web UI (Web based editor). Local “dev” server also works fine. no issue.

  4. Obviously created a route “consumer ot example ot come /*” and assigned the worker.

But when I open the “consumer” in my browser (or curl, wget, etc.), the worker gets executed, but when the code tries to access the “data ot example ot come” it completely bypasses the worker on "data ot example ot come " and directly fetches the page (from the CNAME domain), even after 24 hours the same result.

Am I missing something?

Thanks

P.S.: Please ignore the odd domain names, I had to change all the links, as a new member, I can only post 2 links!!! Seriously!!!

Found my answer here: Issue With Worker-To-Worker HTTPS request

Using the http://data-worker.worker.dev URL using http protocol works for me now.

Thanks