Worker return 1014 error

I have a worker using fetch to get html content for any given URL. It works fine with example URL in Fetch HTML · Cloudflare Workers docs

But if I change URL to www.nodejs.org or www.medium.com, fetch will return 403 with error code 1014. Based on https://support.cloudflare.com/hc/en-us/articles/360029779472#error1014, looks like this is DNS CNAME setting issue. But with worker, worker use fetch to access content should not run into error.

Can it be fixed in worker?
It is important in my use case because my work may fetch any URL.

Nobody has answered, so here are my ideas:

  1. Both www.nodejs and www.medium redirect to no-www. Maybe fetch needs to use the canonical URL.
  2. Even with that, it’s possible the host is actively blocking certain User Agents or other “suspicious” traffic.

Not sure it helps, use follow redirect.

const response = await fetch(url, {
    method: 'POST', // *GET, POST, PUT, DELETE, etc.
    mode: 'cors', // no-cors, *cors, same-origin
    cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
    credentials: 'same-origin', // include, *same-origin, omit
    headers: {
      'Content-Type': 'application/json'
      // 'Content-Type': 'application/x-www-form-urlencoded',
    },
    redirect: 'follow', // manual, *follow, error
    referrerPolicy: 'no-referrer', // no-referrer, *client
    body: JSON.stringify(data) // body data type must match "Content-Type" header
  });

medium.com uses Cloudflare, they could have some protection in place.

1 Like

There is no redirect, it return 403 status code.