Subdomain and custom domain
Hello. Today I’m going to talk about what I recently learned about subdomain and custom domain.
Currently I have two Next.js app running on Vercel.
- Quill-admin: for the dashboard
- Quill-userland: the actual websites generated and running on subdomain.quill.so
Quill-userland is fetching data at getServerSideProps according to its subdomain and slug. I’ve followed the instructions here. It surprisingly worked fine with no issue.
Now, the next step is to support custom domain. I have a domain unfinishedsideprojects.dev. Ironically I didn’t finished that project and the domain is not being used. So I tried to connect it to eunjae.quill.so. First approach was to use Vercel’s built-in features:
At the domain registrar (Google Domains), I set the following records:
@ A 76.76.21.21 * CNAME cname.vercel-dns.com.
I added the domain in my Vercel account and added it to my project on Vercel, Quill-userland.
Surprisingly it worked well. However there are two issues with this approach. If a customer has a domain and already added to their own Vercel account, it won’t work. I have to ask them to remove it from their Vercel account because I have to add it to my account. Another issue is that I can only add up to 50 domains to a project in Vercel. If I exceed the limit, it seems that I need to pay quite a lot.
So I began to find an alternative. There is a service for this approximated.app. I was able to quickly set it up for unfinishedsideprojects.dev. However another issue with this is that I no longer benefit from Vercel’s edge network. All the requests go through Approximated server which is located in California. I was told that I could change the location if I want to but I’m not sure.
I’m going to look for other solutions but I’m doing this in parallel and my main focus is building the actual product. So don’t worry too much and I also appreciate if anyone has experience in this and can find me any advice :)
Thanks for reading and I’ll get back to you soon with some screenshots of the current status.
See you!
Update @ 22 Jul 2021: Approximated now has global clustering, so you’ll no longer lose the benefits of Vercel’s edge network if you choose multiple regions.