Workers can not fetch port 8080

I have test the demo from docs, with changing the host to const someHost = "" and the url to
const url = someHost + "/Test.html" (this is not my website, just a test), it works fine in preview, but returns 404 after deploying. I think the reason may be that it fetched instead of
Can workers only fetch port 80 and 443?

Yes, except if the origin is in your Cloudflare hosted zone.

1 Like

Thanks for the information.
I set a cname subdomain test.f*ckyou* to the in my domain on cloudflare with grey cloud.
Then I change the workers:

const someHost = "http://test.f*ckyou*"
const url = someHost + "/Test.html"

Now it returns 526:
It seemed that workers is still fetching port 80 not 8080. and there is a redirect on the to https. The certificate does not match my test subdomain, so it returns 526.
The question is, why is it still on fetching port 80. I have set up a subdomain with grey cloud on cloudflare according to the above post.

hmm, 526 might be related to ssl (I just googled it). Good luck!

I have tested some cases, they are werid:

  • fetch which is not on cloudflare, return
  • fetch with valid ssl, and this website is NOT on cloudflare, return correctly.
  • fetch http://test.f*ckyou* which is set to orange cloud to, return Error 1101
  • fetch http://test.f*ckyou* which is set to grey cloud, return
  • fetch which is a public port test site hosted by (NOT on cloudflare), return correctly.

So why is return correctly but http://mydomain:8080 return the content from port 80? no matter my domain is on cloudflare or not.


The above is a special case. According to my guess (the source code was not found), it took out the port in request.headers['host'] and printed it. In fact, cloudflare worker still visits 80, but the port number in the url is written into request.headers['host'] and passed to the server as it is.
So, currently, ports other than 80 and 443 can only be fetched through SSL, whether the host is yours or not, even not on cloudflare.
Why does cloudflare have such weird rules?

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.