Worker returns 521 Origin Down when connecting to custom port on gray-cloud domain in my zone

According to this thread it should be working and yet I’m having the error.

So my setup is like this:

I have a gray-cloud A record in my Cloudflare zone pointing to my server IP.
The server is listening at port 8080 that serves a HTTP website.

On my local machine, I verified the HTTP server is live, and the DNS is working, by doing this:


And it returns the page successfully.

Then I setup my Worker script like this:

addEventListener('fetch', event => {

If I run the script in the online editor, it works and renders the page successfully inside the editor environment.
However if I publish the Worker, and access it from my local machine:


Then it returns 521 Origin Down error.

I tried several things and it seems only port 80 is working for the published Worker, while any arbitrary port works inside the online editor environment.

My goal is to use port 8080 in the published Worker script. Please advise how can I get it working.

1 Like