Denni
Denni
CDCloudflare Developers
Created by Denni on 6/24/2024 in #general-help
Catch-all CNAME to pages.dev, DNS and Redirects
Hello all! Problem Description I'm trying to set up my DNS, redirect rules (and even tried a worker) to be able to do the following in order of priority: 1. If DNS entry exists, immediately go to target (e.g. sub.example.com) 2. If redirect rule for subdomain exists, redirect to appropriate page (e.g. twitter.example.com links to my Twitter account through redirect rules) 3. If no DNS or redirect rule exists redirect to example.pages.dev What else I've tried Since the amount of redirect rules is limited, I've also tried making a Worker which handles this but it didn't quite work out cause you can't set a catch-all as a worker route. What I'm looking for I'm looking for an elegant solution which allows me to have proxied subdomains through DNS, a bunch of easily configurable redirect rules and have any other subdomain redirect to the main domain. Current State As of now any unknown subdomain (e.g. test.example.com) just gives a 522 error. (CNAME * to example.pages.dev). Any other DNS entries work properly and defined redirect rules do work as well.
26 replies