I tried this tutorial using Workers for my Cloudflare pages test site but the site times out with this error.
May I ask have you got any A type of the DNS records for your domain name pointed to some IP address (even the default
192.0.2.1 and are they proxied at the DNS tab of Cloudflare dashboard?
May I ask if the 401 Authentication / Password protect is your interest from it here or maybe something more?
Are you using Wrangler, or not in this case?
May I also suggest looking into the below article regarding 522 error:
Do you see any other error, for example does any appear when you test your Worker using the Cloudflare Workers interface “Preview / Send request button”? Or the error appears only when you visit your (sub)domain name URL?
May I ask what SSL option have you got selected under the SSL/TLS tab at Cloudflare dashboard for your domain ( Flexible, Full, Full Strict … )?
The domain is a
.pages.dev one. So I am not sure if that article will help. I only used the workers option.