Multi tenant pages

Is it possible to create a wildcard and have a multi tenant pages project that displays different content based on subdomain?
16 Replies
Konrad
KonradOP8mo ago
GitHub
GitHub - vercel/platforms: A full-stack Next.js app with multi-tena...
A full-stack Next.js app with multi-tenancy and custom domain support. Built with Next.js App Router and the Vercel Domains API. - vercel/platforms
Konrad
KonradOP8mo ago
basically I'd like to host this project on cloudflare pages nvm they use api there instead of wildcard dns i think I also heard that "Cloudflare snippets" will be able to achieve it?
Chaika
Chaika8mo ago
where does wildcard come into this? I don't see them mention it
Konrad
KonradOP8mo ago
yeah, they don't use wildcard in that project they use vercel domain api nvm but a way to use wildcard and cloudflare pages together would be nice
Chaika
Chaika8mo ago
you have two options really 1. Use normal Pages and Pages Custom Domains. Works fine until up to limit (free 100, pro 250, biz 500, ent 500 but raisable). There's an api you can use to add custom domains. 2. Use CF for SaaS and a Worker as Origin proxying to pages, and then the CF for SaaS API. You'd have to pay for every request as a worker invocation though for wildcards, you could do the same thing using a Worker to proxy requests and then just a wildcard route snippets would just let you do that for free (the wildcard option)
Konrad
KonradOP8mo ago
I think if I use 1 domain and just tenant1.mydomain.com, tenant2.mydomain.com I can use DNS records then I will have 1000 records limit? https://community.cloudflare.com/t/wildcard-domains-for-pages/477918/
Chaika
Chaika8mo ago
if you use a wildcard and a worker proxy you have unlimited subdomains
Konrad
KonradOP8mo ago
I see, I wonder how expensive will that be with CF SaaS
You'd have to pay for every request as a worker invocation
doesn't that mean i would be paying double? I already use workers for the app, I just want subdomains based routing
Chaika
Chaika8mo ago
you use pages functions, you mean?
Konrad
KonradOP8mo ago
yeah
Chaika
Chaika8mo ago
then yea you'd be paying for the worker invocation to handle the proxying to pages and then the pages function invocation if any. Standard billing is based off requests + cpu time so the proxied requests would have very little cpu time at least
Konrad
KonradOP8mo ago
and how would that compare price-wise, doing that vs using dns/domain api
Chaika
Chaika8mo ago
you mean doing it via pages custom domains directly, with their hard limits?
Konrad
KonradOP8mo ago
yes if i added e.g. 500 subdomains programmatically vs having a worker proxy https://community.cloudflare.com/t/wildcard-domains-for-pages/477918/ this mentions snippets will be able to act as a proxy too
Chaika
Chaika8mo ago
then you wouldn't be paying for the worker invocation, just functions yea I mentioned snippets in my message as well https://discord.com/channels/595317990191398933/1230191269787996171/1230209450170646579
Konrad
KonradOP8mo ago
I see, I guess I will start with DNS API first and then use snippets when they become available thanks a lot
Want results from more Discord servers?
Add your server