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 version. 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 repository.
It's purpose it to create a proxy to a site you own.
How does it work?
- You have a domain point to Vercel
- Vercel 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
pdi-redirect
. - Pick GitHub.
- Create the repository 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
- Go to your git source where that button created the repo.
- Update the
./_includes/layout/redirect.njk
file 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 propagate.
- That's it.