Add a *.pages.dev alias to an existing project

Hello there I have an existing Pages project configured to a GitHub repo that works ok. I'd like to add a second alias URL to this project using pages (NOT an external domain, since I don't have control on our customer's DNS to register new CNAME entries) I also tried to create a new Pages project but I can't use a GitHub repo that is already used in another Pages project. How can I do that ? (other than by cloning the full GitHub repo ?)
15 Replies
Chaika
Chaika9mo ago
I'd like to add a second alias URL to this project using pages (NOT an external domain, since I don't have control on our customer's DNS to register new CNAME entries)
You mean like a second project.pages.dev? It'd have to be a whole new project
I also tried to create a new Pages project but I can't use a GitHub repo that is already used in another Pages project.
You can't use the same Github repo twice
Monorepos or repositories with multiple codebases/applications currently cannot use the automatic GitHub/GitLab integration to build multiple sites from the same repository. However, Direct Upload can be used to upload a monorepo as separate Pages projects from your own computer.
Lenwë
LenwëOP9mo ago
Actually, what I need is having my http://existingproject.pages.dev/ being accessible from another URL such as http://existingprojectalias.pages.dev/ Our customer have their own DNS to have like http://existingproject.ourcustomer.com but unfortunately I can't create the CNAME entries myself
Chaika
Chaika9mo ago
Only way you could get that is by creating a second pages project alternatively, using custom domains on your own domain As long as you could instruct them to create the CNAMEs, you could add the Custom Domain on your end, tell them to create the CNAME, and it would work
Lenwë
LenwëOP9mo ago
I can't, because the GitHub repo is already used
Chaika
Chaika9mo ago
Right, like posted above you'd have to use Direct Upload or the Pages Action (which is also Direct Upload) to get around that
Lenwë
LenwëOP9mo ago
That's the best option but I have no PoC ATM and I'm not sure this could be done in time :/
Chaika
Chaika9mo ago
idk what exactly you're going for, but why not just add custom domains on your own domains? ex. existingproject.projects.yourdomain.com, existingprojectalias.projects.yourdomain.com Why does it have to be an alias on the pages.dev? Generally it's a good idea to use your Custom Domain instead anyway because you have full control over waf/security/caching/etc
Lenwë
LenwëOP9mo ago
I don't have access to the custom domain, that's the problem. I can't do it myself.
Chaika
Chaika9mo ago
You have no domains in cloudflare you can use at all?
Lenwë
LenwëOP9mo ago
No, but is it possible to create one for free ? (just asking)
Chaika
Chaika9mo ago
You can add websites to Cloudflare's free plan for free, but registration is a seperate matter. You'd have to register a domain elsewhere or use CF Registrar, like $10/year for com or something again I don't really understand your end goal here but it sounds like it would be easier to get a domain in Cloudflare, and then you can freely add Custom Domains/don't have to create multiple pages project
Lenwë
LenwëOP9mo ago
Yes, using a custom domain is the best option. I'll probably do this but it will take longer than expected. Thanks ! One last question, we have preview branches, can we create subdomains for them ? ie we have domain company.com with subdomains myproject.company.com (production) and preview.myproject.company.com (Preview) main branch has CNAME entry myproject to myproject.pages.dev Can we create CNAME entry preview.myproject to preview,myproject.pages.dev and make sure we'll get on the preview instance while accessing preview.myproject.company.com ?
Chaika
Chaika9mo ago
Only if you're using CF DNS
Chaika
Chaika9mo ago
Cloudflare Docs
Add a custom domain to a branch · Cloudflare Pages docs
In this guide, you will learn how to add a custom domain (staging.example.com) that will point to a specific branch (staging) on your Pages project.
Lenwë
LenwëOP9mo ago
Oh, 💩 Thanks ! One last question (again) Does it work with subdomains ? Let’s say we have Cloudflare subdomain project.company.com and project at url project.pages.dev, can we have staging.project.company.com pointing to staging.project.pages.dev ? Just purchased a custom domain, it also works with sub domains so this is perfect.
Want results from more Discord servers?
Add your server