Skip to content

Custom domain

The default lending-agent-presenter.vercel.app URL is fine for the demo. A production deployment goes on a custom domain so the rep tablet, customer phone, and admin portal carry the retailer-or-broker brand. This page walks the DNS setup.

Three common patterns:

PatternExampleUse when
Apex on broker brandquotes.broker-domain.co.ukBroker is the customer-facing entity
Subdomain per retailerquotes.retailer-domain.co.ukEach retailer wants their own cosmetic URL
Single shared subdomainapp.shermin.exampleMulti-retailer SaaS, retailers identified by signed URL path

The third pattern is cheapest to operate. The first two are most commonly requested. You can run all three on the same Vercel project by adding multiple domains.

In the Vercel project, Settings > Domains > Add.

StepAction
1Type the domain. E.g. quotes.broker-domain.co.uk.
2Vercel detects whether it’s apex or subdomain.
3Vercel shows the required DNS record.

For an apex domain (broker-domain.co.uk):

RecordTypeValue
ApexA76.76.21.21

For a subdomain (quotes.broker-domain.co.uk):

RecordTypeValue
SubdomainCNAMEcname.vercel-dns.com

Set in your DNS provider (Cloudflare, Route 53, etc.). DNS propagation takes anywhere from minutes to a few hours; Vercel polls and confirms once it sees the record.

Vercel auto-provisions a Let’s Encrypt certificate as soon as DNS resolves. No action required. Renewal is automatic. The certificate covers the apex and any subdomain you add to the same project.

If your DNS provider proxies traffic (Cloudflare orange cloud), you have two choices:

ModeBehaviour
Cloudflare proxy on, SSL/TLS “Full (strict)“Cloudflare presents its own certificate; Vercel still serves a valid certificate behind.
Cloudflare proxy off (DNS-only, grey cloud)Vercel handles HTTPS directly. Recommended for simplicity.

For most production deploys, recommend grey cloud (DNS-only) so Vercel’s analytics, logs, and edge logic see the original request without Cloudflare in the path.

The Vercel UI offers a “redirect to” option when adding a second domain. Common pattern:

AddRedirect to
www.quotes.broker-domain.co.ukquotes.broker-domain.co.uk (apex of the chosen subdomain)

Vercel issues the 308 redirect and serves the certificate for the www host as well.

For a marketing setup that needs www as the primary:

AddRedirect to
broker-domain.co.uk (apex)www.broker-domain.co.uk
www.broker-domain.co.uk(no redirect; primary)

Pick one canonical and stick to it. Don’t run both as primaries; SEO and analytics break.

If multiple retailers share app.shermin.example, the path determines the retailer. Vercel sees one domain; the Next.js app reads retailerId from the URL.

https://app.shermin.example/r/<retailerId>?sig=<HMAC>

This is the cheapest model. The retailer has no DNS to set up; they just bookmark the URL on their tablets.

For retailer-branded domains, each retailer adds the domain to your Vercel project. They control their DNS; you don’t.

After DNS resolves and Vercel marks the domain “valid”:

  1. Open https://<domain>/. The marketing landing should load with a green padlock.
  2. Open https://<domain>/demo/rep. Rep tablet should load.
  3. curl -I https://<domain>/. Confirm HTTP/2 200 and strict-transport-security header.
  4. dig <domain>. Confirm the A or CNAME record is correct.

A Vercel project can hold many domains. Each can be:

RoleBehaviour
Production primaryDefault. The “production URL” the dashboard shows.
Production aliasSame content as primary; useful for retailer-branded subdomains.
Redirect target308s to the primary.

For multi-retailer deployments where each retailer wants their own subdomain, add them all as production aliases. The Next.js middleware reads the host header and routes accordingly.

middleware.ts
export function middleware(req: NextRequest) {
const host = req.headers.get("host") ?? "";
const retailer = lookupRetailerByHost(host);
if (retailer) {
req.headers.set("x-retailer-id", retailer.id);
}
return NextResponse.next();
}

lookupRetailerByHost reads from a small in-memory map populated at build time, or from KV for a runtime-configurable mapping.

PracticeWhy
One canonical primary per environmentAvoid SEO duplication, simplify analytics
HSTS preloading after 60 daysForce HTTPS at the browser level
Content-Security-Policy headerSee production hardening
X-Frame-Options: DENYPrevent the rep tablet or customer phone surface from being embedded in third-party sites
Audit DNS records quarterlyCatch stale CNAMEs and unused subdomains pointing at the project

In Vercel: Settings > Domains > Remove. The DNS record at your provider becomes orphaned; remove it there too. Existing traffic to the removed domain receives a Vercel “deployment not found” page until the DNS record is removed.

If the domain is being decommissioned (retailer offboarding), follow the offboarding clause in the SaaS agreement: data export within 30 days, deletion at end of retention.