Setting Up a Custom Domain
You can point your own domain to a container running on Bahriya. This guide walks through the steps to configure a custom domain with HTTPS.
Prerequisites
- A container deployed on Bahriya with at least one region active.
- A domain you control with access to its DNS settings (at your domain registrar or DNS provider).
Step 1: Configure the hostname on your container
In your container settings, set the custom hostname field to your domain — for example, app.example.com.
Choose a DNS mode that determines how traffic is routed:
| Mode | How it works | DNS record you create |
| None | Traffic goes directly to each region. No Bahriya-managed DNS. | A/AAAA records pointing to each region's gateway IP |
| Round-robin | Bahriya distributes traffic evenly across your active regions. | CNAME to your container's vanity hostname |
| Geo | Bahriya routes users to the nearest region based on their location. | CNAME to your container's geo hostname |
Step 2: Create DNS records at your provider
For round-robin or geo mode
Create a CNAME record at your DNS provider:
app.example.com CNAME <your-container-handle>.<dns-zone>
The exact CNAME target is shown in your container's networking settings in the console.
For "none" mode
Create A records pointing to the gateway IP of each region where your container is deployed. The gateway IPs for each region are listed in the Regions documentation.
If using a root domain (apex)
Most DNS providers do not support CNAME records on root domains (example.com without a subdomain). Options:
- Use a subdomain instead (
app.example.com, www.example.com).
- Use a DNS provider that supports CNAME flattening or ALIAS records (e.g. Cloudflare, DNSimple, Route 53).
Step 3: TLS certificate
Bahriya automatically provisions and renews a TLS certificate for your custom domain once the DNS records are in place. This typically takes a few minutes after the DNS change propagates.
You do not need to upload your own certificate or manage renewals.
Step 4: Verify
Once DNS propagation is complete (usually a few minutes, can take up to 48 hours depending on your DNS provider and TTL settings), visit your custom domain in a browser. You should see your application served over HTTPS.
WWW redirect
If your custom hostname is a bare domain (e.g. example.com), you can enable WWW redirect. When enabled:
- Requests to
www.example.com are redirected to example.com (or vice versa).
- Bahriya provisions a TLS certificate covering both the bare domain and the
www subdomain.
- You need to create DNS records for both
example.com and www.example.com.
Troubleshooting
"Not secure" or certificate error:
- DNS may not have propagated yet. Check with
dig app.example.com or an online DNS checker.
- Ensure the CNAME or A record points to the correct target.
- Wait a few minutes for the TLS certificate to be provisioned.
Site not loading:
- Verify the DNS record type is correct (CNAME for round-robin/geo, A for none mode).
- Check that the container is running and healthy in the Bahriya console.
- If using a CDN or proxy (e.g. Cloudflare), ensure it is not interfering with the certificate provisioning. You may need to temporarily disable proxying.