Skip to content
Tutorials Center
My learning

Topics

Lesson 21 of 37 ยท Domains, HTTPS and Redirects

HTTPS and Certificates

How automatic HTTPS works on Vercel and Netlify: Let's Encrypt style certificates, wildcard and custom certificates, HSTS, renewal and fixing mixed content and certificate errors.

Both platforms serve every site over HTTPS by default. When your domain is verified, the platform requests a certificate for it from a public certificate authority, installs it on the edge network, and renews it before it expires. You do nothing. This lesson explains what happens behind that convenience, so you can reason about it when something goes wrong.

The products cannot run on this site. Behavior is described from their documentation; the code is a labelled JavaScript stand-in that models how a browser matches a hostname to a certificate.

What a certificate proves

HTTPS is HTTP inside TLS. A TLS certificate binds a public key to one or more hostnames, and is signed by a certificate authority (CA) that browsers trust. When you visit www.example.com, the server presents its certificate; the browser checks that:

  1. the name you typed appears in the certificate's Subject Alternative Names (SANs),
  2. the current date is between "not before" and "not after",
  3. the signature chain leads to a trusted root.

If any check fails you see a full-page warning. The usual causes on a new site are a name mismatch (the domain is not yet attached) and an expired or not-yet-issued certificate.

How the platforms issue them

To get a certificate, you must prove you control the name. The CA offers challenges:

  • HTTP-01: the CA fetches a token from http://yourname/.well-known/acme-challenge/.... The platform answers it, which only works once DNS points at the platform. This is why a certificate appears only after your records are right (see Custom Domains and DNS).
  • DNS-01: the CA looks for a TXT record at _acme-challenge.yourname. This is required for wildcard certificates (*.example.com). It works automatically only when the platform controls your DNS zone (nameserver delegation), or you add the record yourself.

A wildcard covers exactly one label: *.example.com matches blog.example.com but not example.com (the apex) and not a.b.example.com. Certificates usually list the apex as a separate SAN.

Certificate lifecycle

Verify Prove you control the name.
Issue A CA signs the certificate.
Install The edge network serves it.
Renew New one before the old expires.

All automatic when DNS is correct.

1 / 2

Matching hostnames

This stand-in implements the matching rule from the previous section and a simple validity check. It is a model, not real TLS, and it uses made-up certificates.

JS Certificate matching stand-in

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Renewal windows

Public certificates are short-lived (90 days is common) precisely so renewal is automated. Platforms usually renew when about a third of the lifetime remains. The stand-in below lists when a renewal would start and flags the dangerous case where automation has been failing.

JS Renewal planner stand-in

Press Run (or Ctrl + Enter) to see the console output here.

No output.

HSTS, redirects and mixed content

  • HTTP to HTTPS redirect. Both platforms redirect plain HTTP to HTTPS automatically. You do not need a rule for it.
  • HSTS. The Strict-Transport-Security header tells browsers to use HTTPS only for a period. Add it yourself with a custom header (see Response Headers and Security). Start with a short max-age before committing to a year, and add includeSubDomains only when every subdomain really supports HTTPS.
  • Mixed content. An HTTPS page that loads http:// images or scripts will have them blocked or flagged. Use https:// URLs or root-relative paths such as /img/logo.png.

Custom certificates

Teams that must use an organization's certificate (for extended validation, or an internal CA chain) can upload their own on paid plans: a PEM-encoded certificate, its private key and the chain. You then own renewal. Treat the private key as a secret, and set a calendar reminder well before expiry.

When certificates fail

Symptom Likely cause Fix
"Certificate pending" for hours DNS not pointing at the platform, or CAA blocks issuance correct records, add the CA to CAA
Browser says name mismatch domain not attached to the project, or wildcard used for the apex add the exact hostname
Redirect loop proxy set to "flexible" SSL while the origin forces HTTPS use end-to-end (full) mode or DNS-only
Works on some devices only old resolver cache after DNS change wait for TTL

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which hostname does the wildcard certificate *.example.com cover?

    A wildcard matches exactly one label in front of the suffix. The apex and deeper subdomains need their own SAN entries.
  2. 2. Why does a certificate usually appear only after DNS is correct?

    The CA proves control by fetching a token from your domain, which only reaches the platform once DNS points there.
  3. 3. What is a sensible way to roll out HSTS?

    Browsers remember HSTS for the whole max-age, so a mistake with a long value is hard to undo.
  4. 4. What does a CAA record do?

    If CAA exists and omits the platform's CA, issuance fails.

Summary

  • A certificate links a key to hostnames; browsers check name, dates and signature chain.
  • Platforms issue and renew certificates automatically once DNS is correct.
  • Wildcards need DNS-01 and cover one label, not the apex.
  • HTTP redirects to HTTPS automatically; HSTS is opt-in via headers.
  • Pending certificates are usually a DNS, CAA or proxy problem.

Next: Redirects and Rewrites