I need to setup a custom URL for my preview deployments

One of the services I am using needs a custom TXT record in the site domain so this prevents me for using pages.dev as the domain. I tried to add a wilcard CNAME, but this would require the advanced certificate manager. I am ok with the advanced certificate manager, but can it in fact create a custom wildcard certificate for the CNAME pointing to *.APPNAME.pages.dev? I don't want to get the subscription and then find out I can't create wildcard certificates.
19 Replies
Walshy
Walshy4mo ago
I'm not sure what you're trying to do exactly
richtera
richteraOP4mo ago
I need my preview deploys on a custom domain.
Walshy
Walshy4mo ago
Do you have a domain? I'm not sure where the TXT is coming from here If you just want to link your domain to pages.dev you add it in the Pages section and then add the CNAME
richtera
richteraOP4mo ago
Yes I have a custom domain, but I need the preview deploys on a custom domain.
Walshy
Walshy4mo ago
You can't have all the previews on a custom domain but you can setup branches just like any regular domain Docs for that: https://developers.cloudflare.com/pages/how-to/custom-branch-aliases/
richtera
richteraOP4mo ago
Checking. Yea that won't work. Each deployment uses the pr number so it's like pr-123.APP.pages.dev which needs to be redirected automatically each time.
richtera
richteraOP4mo ago
Cloudflare Docs
Redirecting *.pages.dev to a Custom Domain | Cloudflare Pages docs
Learn how to use Bulk Redirects to redirect your *.pages.dev subdomain to your custom domain.
Hard@Work
Hard@Work4mo ago
That redirects all of your pages.dev to a single branch(usually production)
richtera
richteraOP4mo ago
Yea but that also doesn't allow . hmmm.
Hard@Work
Hard@Work4mo ago
Which I don't think is what you want
richtera
richteraOP4mo ago
Looks like it's not going to work at all. Basically in netlify you can just change the deployment base domain, I was hoping for something like that.
Hard@Work
Hard@Work4mo ago
Like where new production deployments land? Or...
richtera
richteraOP4mo ago
Not production but preview. Production has a custom domain so that's fine. But when PRs are getting built they currently land on BRANCH.APP.pages.dev. This is where I cannot add TXT records into. The external service the web pages is connecting to is going to validate that the referer domain has a valid TXT record in it.
Hard@Work
Hard@Work4mo ago
Yeah, I don't think there is any way to solve that atm
richtera
richteraOP4mo ago
That means preview deployments won't be usage to any app using something like wallet connect for example.
richtera
richteraOP4mo ago
There is another way to use /.well-known/walletconnect.txt we'll try. If the content is not dependent on the domain name then this could possibly work. I think it should be a feature similar to the one for workers. i.e. ....pic... there shoudl really be an entry for pages or something custom per pages site (i.e. a custom domain for production and preview separately)
No description
Chaika
Chaika4mo ago
can you clarify what you mean starting from the top? You say "TXT Records" but then say "/.well-known/walletconnect.txt", that's a url path to a txt file, not a Record, which is a dns concept. You want all your preview domains to serve /.well-known/wellconnect.txt?
richtera
richteraOP4mo ago
So there are two ways to validate domains. 1. Add a TXT record which changes per domain, since our domains are pr-nnn.APP.pages.dev where the APP is the cloudflare pages project name the a record would need to be dynamically generated and applied with the cloudflare cli. But that assumes we can get the required record from wallet connect and then apply it. 2. there is a chance we could get a wilcard verification record for *.APP.pages.dev and add it into the deployment static files under /.well-known/walletconnect.txt which is a second place walletconnect checks to validate domains for their API to be whitelisted.
Chaika
Chaika4mo ago
you can't add txt records on the app.pages.dev so that first one would never work sounds like the second way is your best hope
Want results from more Discord servers?
Add your server