Workers can not fetch port 8080

I have test the demo from docs, with changing the host to const someHost = "http://www.asnt.org:8080" 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 http://www.asnt.org/Test.html instead of http://www.asnt.org:8080/Test.html
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*sshole.uk.to to the www.asnt.org in my domain on cloudflare with grey cloud.
Then I change the workers:

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

Now it returns 526: https://test.crazyboyfeng.workers.dev/
It seemed that workers is still fetching port 80 not 8080. and there is a redirect on the http://www.asnt.org:80 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 http://test.crazyboyfeng.eu.org:8080 which is not on cloudflare, return http://test.crazyboyfeng.eu.org:80
  • fetch https://test.crazyboyfeng.eu.org:8443 with valid ssl, and this website is NOT on cloudflare, return correctly.
  • fetch http://test.f*ckyou*sshole.uk.to:8080 which is set to orange cloud to test.crazyboyfeng.eu.org, return Error 1101
  • fetch http://test.f*ckyou*sshole.uk.to:8080 which is set to grey cloud, return http://test.crazyboyfeng.eu.org:80
  • fetch http://portquiz.net:8080 which is a public port test site hosted by dns105.ovh.net (NOT on cloudflare), return correctly.

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


UPDATE:

The above http://portquiz.net 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.