Navigating Custom Domains in Laravel Vapor

Breaking Free from Mandatory DNS Migration

Many developers worry that moving to

requires a total migration of their DNS management. You can keep your existing setup. Whether you use
Cloudflare
or another provider,
Laravel Vapor
works alongside them. However, you must still add the domain to the
Laravel Vapor
dashboard. This action triggers the creation of a hosted zone in
AWS
, which is a vital collection of records used to route traffic to
API Gateway
or an
Application Load Balancer
.

The Cloudflare Advantage for API Gateway v2

Choosing a DNS strategy often depends on your underlying infrastructure. If you use

for its speed and cost-effectiveness,
Cloudflare
becomes a powerful ally.
API Gateway v2
does not natively handle the redirection from HTTP to HTTPS. By keeping
Cloudflare
as your external provider, you can manage that secure handshake at the edge, ensuring users always land on the encrypted version of your site without extra code.

Managing Subdomains and Root Domains

A common point of confusion is whether you can register a single subdomain without touching the root.

requires the root domain to create a unified hosted zone. This isn't just bureaucracy; it allows
Laravel Vapor
to issue a single, auto-renewing wildcard
SSL certificate
. This certificate covers the root, subdomains, and any wildcards you define in your configuration file, drastically simplifying your security overhead.

Safe Imports for Existing AWS Records

If you already have a hosted zone in your

account,
Laravel Vapor
won't destroy your hard work. When you add an existing domain,
Laravel Vapor
imports the current records into its internal database. It leaves your existing entries untouched, only adding new records necessary for
SSL certificate
validation or deployment routing. It behaves as a surgical tool, not a wrecking ball.

2 min read