522 Error for WWW Subdomain when Root Domain Works (Worker as Origin)

For Workers & Pages, what is the name of the domain?

example

What is the error number?

5 2 2

What is the error message?

Connection timed out Error code 5 2 2 Visit cloudflare for more information. 2025-06-27 13:14:58 UTC

What is the issue or error you’re encountering

I’m experiencing a persistent 5 2 2 ‘Connection timed out’ error specifically for my www subdomain (example) while my root domain (example) is working perfectly. Both domains are routing through a Cloudflare Worker. (h t t p s w w w blah com fails, while blah com succeeds.

What steps have you taken to resolve the issue?

Root Domain (example com): Configured as a ‘Custom domain’ on my Worker. This works, and my Worker successfully proxies content from my Cloudflare Pages project. WWW Subdomain (www example com): Configured in DNS as a C N A M E record. It points directly to my Worker’s workers.dev subdomain (e.g., my-worker-name my-account workers dev). It is proxied (orange cloud). Despite this setup and multiple cache clears (browser and Cloudflare DNS toggle), www example dot com consistently returns a 5 2 2. When I run www example com/cdn-cgi/trace, I get output, which suggests the request is hitting Cloudflare’s edge, but then timing out when connecting to the Worker.

What are the steps to reproduce the issue?

I’m experiencing a persistent 5 2 2 ‘Connection timed out’ error specifically for my www subdomain (h t t p s w w Uploading: Screen Shot 2025-06-27 at 9.21.29 AM.png…
w example com ) while my root domain (h t t p s example com ) is working perfectly. Both domains are routing through a Cloudflare Worker.

1 Like

If you want to also use the www subdomain, you also need to configure it as a custom domain.

However, it might be better to just use redirect rules and redirect the www subdomain to your root domain.

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