Custom Domain for PDIs using Vercel
I was able to do this with the help of Mav and Mike Bahr. Thanks guys!
First of all this fixes the redirect issues from the Netlify verison. Netlify appends a slash to some endpoints. I don't see a way to control it, Vercel lets you control how that works.
Simple Vercel Proxy
This is a simple repo.
It's purpose it to create a proxy to a site you own.
How does it work?
- You have a domain point to Vercel
- Vecel has a "redirect/rewrite" rule that doesn't redirect instead proxies
- That's it
What do I have to do?
- A github account.
- Access to your DNS for the domain to create appropriate records.
- A Vercel account.
Ok, I'm ready!
Deploy the repo
- Login with GitHub, trust me.
- Enter a project name, I called mine
- Pick GitHub.
- Create the repositry private or public, your choice.
- Leave the Import Project settings, they were auto-detected by Vercel, and "Deploy".
- Now it's building, it'll take about 20 seconds to build.
- You should get a 🎉 CONGRATULATIONS 🎉 message. It should work now.
Well, it's redirecting to my site. Let's fix that.
Update the repo to point to your site
- Goto your git source where that button created the repo.
- Update the
./_includes/layout/redirect.njkfile to the site you want.
- Vercel should trigger a build and update index.html and 404.html to redirect to your site.
Set up the domain
- Now you need to set up the domain. To do that goto "Domains",
- It'll ask what project you want to use, pick the one you made from #1.
- It will show you, that your DNS is wrong. Go forth and set the dns as depicted.
- Comeback to Vercel's domain page and "Refresh" your domain entry. You may need to wait for your DNS to propegate.
- That's it.