Next.js Discord

Discord Forum

Custom domain for a wildcard domain?

Answered
Giant panda posted this in #help-forum
Open in Discord
Avatar
Giant pandaOP
Say I have X tenant and he's at xyz.domain.com, I am wondering what is the best way to add a feature where he can link his domain?
Answered by require("anay-208")
So:
- Use vercel api to create a new domain
- get the DNS records from vercel api
- Provide it to the tenant
- Verify it
- it'll be served by vercel :vercel:
View full answer

94 Replies

Avatar
require("anay-208")
link his domain with?
Avatar
Giant pandaOP
so say he has the tenant subdomain xyz
now i want it so he can link his own domain
i am not sure if this is possible though i imagine it is given how many people have multitenant services on Vercel
perhaps cname record would work just fine but i havent tested
Avatar
require("anay-208")
So you're basically providing a SaaS, and giving him a panel to add his domain?
Avatar
Giant pandaOP
essentially thats it
like shopify say where the user can link his own domain
Avatar
require("anay-208")
Well, If you're using vercel, then you gotta tell the tenant to add vercel CNAME record
and use vercel api to add custom domain
Avatar
Giant pandaOP
but what would that do?
Avatar
require("anay-208")
add the custom domain?
Avatar
Giant pandaOP
not sure what you mean by using the api to add a custom domain
xyz.domain.com would become tenantsdomain.com. but i am not sure if that is achieved by adding the domain on vercel
Avatar
require("anay-208")
So vercel allows traffic through tenantsdomain.com
Avatar
Giant pandaOP
right but im just confused, if the app is running on a wildcard domain, how would adding a custom domain with the api make it so that tenantsdomain.com is the same as xyz.domain.com
Avatar
require("anay-208")
So:
- Use vercel api to create a new domain
- get the DNS records from vercel api
- Provide it to the tenant
- Verify it
- it'll be served by vercel :vercel:
Answer
Avatar
Giant pandaOP
i fail to see how that will achieve what i want but ill give it a try
Avatar
require("anay-208")
@Giant panda any updates
Avatar
Giant pandaOP
i should be trying it soon
i didnt yesterday
Avatar
Giant pandaOP
i mean i think i hear you
i'm essentially just adding a domain
nothing more nothing less
than i'll be identifying the tenant by this domain. simple as that.
Avatar
require("anay-208")
if your issue is resolved, you can mark this message as a solution
Avatar
Giant pandaOP
ive not tested fully yet, but i will if it works
Avatar
require("anay-208")
Alright!
Do give me updates!
Avatar
Giant pandaOP
trying to
understand
this actually works
i keep passing name in the body but nothing happens, it doe snot update the domain
trying to update the project domain but of course it doesnt work for some reason
it says ability to update the domain but there is no way to do so
it seems i have to delete the domain if theres an update
at any rate
Avatar
Giant pandaOP
what an odd api
keeps telling me it is under a different scope
when it isnt
and in the code it tells me unsupported media type
i cant tell at all how to get the challenges
its all talked about in docs but it exists not
too bad
Avatar
Giant pandaOP
Image
this is the problem
a certain domain may have this option
other times it'll be cname
and i cannot guess that
Avatar
Giant pandaOP
do you know by chance
is there some sort of webhook for vercel
that sends events when domain is verified etc
i guess not
Avatar
require("anay-208")
@Giant panda If I'm right, if the path is @, then the record is A, otherwise the record is CNAME
Avatar
Giant pandaOP
havent had that experience
Avatar
require("anay-208")
I did actually
Avatar
Giant pandaOP
i tried .xyz domain path is @ got an A record
Avatar
require("anay-208")
You can try it out
Avatar
Giant pandaOP
.com domain path is @ got a cname
I'm not guessing, I've tested this
Avatar
require("anay-208")
lemme see
Avatar
Giant pandaOP
ive no idea why
Avatar
require("anay-208")
I'm talking about subdomain
Avatar
Giant pandaOP
well i dont have subdomains
Avatar
require("anay-208")
if there is a subdomain, then its usually CNAME, otherwise A
I'll quickly verify it
Avatar
Giant pandaOP
and it seems with a custom domain for tenant
cloudflare is no longer enforced
Avatar
require("anay-208")
I checked for @, its A, for other, its CNAME
Umm, they've to turn on proxy + change SSL settings
Avatar
Giant pandaOP
well all i know is i have the option add domain to the project
i add it
for one domain its cname
the other its A
i dont have an idea what you're talking about, that may be internally but i only add the domain
Avatar
require("anay-208")
because its prob like www.domain.com (CNAME), and domain.com(A)
Avatar
Giant pandaOP
and yet every domain input is www.domain.com
but www.domain.xyz ends up with an a record
while www.domain.com ends up with cname
Avatar
require("anay-208")
can you send a screenshot
while puting pen on the domain name
Avatar
Giant pandaOP
i cant. i do this with code
Avatar
require("anay-208")
Sorry, I didn't get that
I just need a screenshot which shows subdomain www, and record A
Avatar
Giant pandaOP
you keep talking about subdomains
but i have none
i will send a screenshot though in a moment
Avatar
require("anay-208")
If you have no subdomain, then yes, the record will be A
Avatar
Giant pandaOP
okay got it.
i think it'll work fine
though cloudflare wont
Avatar
Giant pandaOP
It's working indeed
Avatar
require("anay-208")
Mark this message as a solution since your issue is resolved