Navigating Custom Domains in Laravel Vapor
Breaking Free from Mandatory DNS Migration
Many developers worry that moving to Laravel Vapor 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 API Gateway v2 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. Laravel Vapor 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 AWS 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.
- Laravel Vapor
- 39%· products
- Cloudflare
- 17%· companies
- API Gateway v2
- 11%· products
- AWS
- 11%· companies
- SSL certificate
- 11%· products
- Other topics
- 11%

Q&A on Using Custom Domains in Vapor
WatchLaravel // 5:42
The official YouTube channel of Laravel, the clean stack for Artisans and agents. We will update you on what's new in the world of Laravel, from the framework to our products Cloud, Forge, and Nightwatch.