DNS Requirements
For custom domains to work with Larafast Multi-Tenancy, proper DNS configuration is essential. The system automatically verifies DNS records before provisioning sites and SSL certificates.
DNS Record Types
A Record (IPv4)
The most common configuration is to point your custom domain directly to your server’s IP address using an A record.
Example:
Type: A
Name: app (or @ for root domain)
Value: 203.0.113.42
TTL: 3600
This creates:
app.yourdomain.com → 203.0.113.42
- Or
yourdomain.com → 203.0.113.42 (if using @)
AAAA Record (IPv6)
If your server has an IPv6 address, you should also configure an AAAA record:
Type: AAAA
Name: app
Value: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
TTL: 3600
CNAME Record
Alternatively, you can use a CNAME record to point to your main domain or server hostname:
Type: CNAME
Name: app
Value: yourmainapp.com
TTL: 3600
CNAME records cannot be used for root domains (e.g., yourdomain.com). Use A records for root domains.
DNS Configuration by Provider
Cloudflare
- Log in to your Cloudflare dashboard
- Select your domain
- Navigate to DNS → Records
- Click Add record
- Configure:
- Type: A
- Name: app (or your subdomain)
- IPv4 address: Your server IP
- Proxy status: DNS only (orange cloud OFF)
- TTL: Auto
- Click Save
When using Cloudflare, ensure “Proxy status” is set to DNS only (gray cloud). The orange cloud (proxied) can interfere with SSL provisioning.
DigitalOcean
- Log in to your DigitalOcean account
- Navigate to Networking → Domains
- Select your domain or add a new one
- Under Add a record, select:
- Type: A
- Hostname: app
- Will Direct To: Your server IP
- TTL: 3600
- Click Create Record
AWS Route 53
- Log in to AWS Console
- Navigate to Route 53 → Hosted Zones
- Select your domain
- Click Create Record
- Configure:
- Record name: app
- Record type: A
- Value: Your server IP
- TTL: 300
- Routing policy: Simple routing
- Click Create records
Namecheap
- Log in to Namecheap
- Go to Domain List → Select your domain
- Click Manage → Advanced DNS
- Click Add New Record
- Configure:
- Type: A Record
- Host: app
- Value: Your server IP
- TTL: Automatic
- Click the checkmark to save
GoDaddy
- Log in to GoDaddy
- Go to My Products → Domains
- Click DNS next to your domain
- Under Records, click Add
- Configure:
- Type: A
- Name: app
- Value: Your server IP
- TTL: 1 Hour
- Click Save
Google Domains
- Log in to Google Domains
- Select your domain
- Click DNS on the left sidebar
- Scroll to Custom resource records
- Add a new record:
- Name: app
- Type: A
- TTL: 1H
- Data: Your server IP
- Click Add
DNS Verification Process
When a team adds a custom domain, Larafast Multi-Tenancy automatically verifies DNS configuration:
1. DNS Lookup
The system performs DNS lookups to verify the domain points to your server:
// Example of what the system checks
$dnsRecords = dns_get_record('app.clientdomain.com', DNS_A);
// Verifies if any record matches your server's IP
2. Verification Job
The VerifyDomainDnsRecordsJob runs to check DNS:
- Queries DNS records for the custom domain
- Compares resolved IP with your server’s IP
- Updates the domain record with verification status
- Fires
DnsVerified event on success
3. Retry Logic
If DNS verification fails:
- The system retries up to 3 times
- Tracks retry attempts in
dns_verification_attempts
- Waits between retries for DNS propagation
4. Automated Progression
Once DNS is verified:
DnsVerified event is fired
CreateForgeSite listener creates a Forge site
CreateForgeSiteCertificateJob provisions SSL certificate
- Team is notified when complete
DNS Propagation Time
DNS changes take time to propagate across the internet:
| Provider | Typical Propagation Time |
|---|
| Cloudflare | 2-5 minutes |
| DigitalOcean | 5-30 minutes |
| AWS Route 53 | 1-5 minutes |
| Namecheap | 30 minutes - 2 hours |
| GoDaddy | 1 hour - 24 hours |
| Google Domains | 5-30 minutes |
You can use tools like whatsmydns.net to check DNS propagation globally.
Best Practices
1. Lower TTL Before Changes
Before configuring a custom domain:
- Lower the DNS TTL to 300-600 seconds (5-10 minutes)
- Wait for the old TTL to expire
- Make your DNS changes
- After verification, you can increase TTL back to 3600 (1 hour)
2. Use Subdomains
Prefer subdomains over root domains:
- ✅
app.clientdomain.com (subdomain)
- ❌
clientdomain.com (root domain)
Subdomains are more flexible and can use CNAME records.
3. Disable Proxying
If using Cloudflare or similar CDN:
- Disable the proxy (orange cloud) during initial setup
- Enable it after SSL is active (optional)
4. Check Before Adding
Advise your users to:
- Configure DNS records first
- Wait 5-10 minutes for propagation
- Then add the domain in your application
Monitoring DNS Status
Check Domain Status
Use the Filament admin panel to check domain status:
// In your TeamResource or custom page
Forms\Components\Placeholder::make('domain_status')
->content(function ($record) {
if (!$record->domain) {
return 'No domain configured';
}
$domain = $record->domains()->where('domain', $record->domain)->first();
if (!$domain) {
return '⏳ Pending DNS verification';
}
if (!$domain->dns_verified) {
return "❌ DNS not verified (Attempts: {$domain->dns_verification_attempts})";
}
if (!$domain->ssl_installed) {
return '⏳ SSL certificate being installed';
}
if (!$domain->ssl_active) {
return '⏳ SSL certificate being activated';
}
return '✅ Domain active and secure';
})
Manual DNS Check
Check DNS records manually using command line:
# Check A records
dig +short app.clientdomain.com A
# Check with specific nameserver
dig @8.8.8.8 app.clientdomain.com A
# Detailed DNS query
nslookup app.clientdomain.com
Monitor Verification Attempts
Query the database to see verification status:
// Get all pending verifications
\App\Models\Domain::where('dns_verified', false)->get();
// Get domains with multiple failed attempts
\App\Models\Domain::where('dns_verification_attempts', '>', 3)->get();
Troubleshooting DNS Issues
DNS Not Resolving
Problem: DNS lookups return no results.
Solution:
- Verify the DNS record was created correctly
- Check for typos in the domain name
- Wait for DNS propagation (5-30 minutes)
- Use
dig or nslookup to verify
Wrong IP Address
Problem: DNS resolves to wrong IP address.
Solution:
- Update DNS record with correct IP
- Lower TTL for faster propagation
- Clear local DNS cache:
sudo dscacheutil -flushcache (macOS)
- Wait for propagation
Cloudflare Proxy Issues
Problem: DNS verification fails with Cloudflare.
Solution:
- Click the orange cloud to make it gray (DNS only)
- Wait 2-5 minutes for changes to propagate
- Retry verification
Multiple A Records
Problem: Domain has multiple conflicting A records.
Solution:
- Remove old/incorrect A records
- Keep only the record pointing to your server
- Wait for DNS propagation
Advanced: Wildcard Domains
If you want to support wildcard domains (e.g., *.clientdomain.com):
DNS Configuration
Type: A
Name: *
Value: Your server IP
TTL: 3600
This allows any subdomain to work:
app.clientdomain.com
portal.clientdomain.com
anything.clientdomain.com
Server Configuration
On your Forge server, you’ll need to:
- Configure Nginx to handle wildcard domains
- Use wildcard SSL certificates
- Adjust your application routing logic
Wildcard domain support requires additional configuration beyond the standard custom domains setup.
Next Steps