Custom Domain Mapping
Map domain riêng (yourapp.com, app.yourcompany.vn) vào service Cloud Run chạy trên Zeni Cloud. SSL tự động bởi Google Trust Services và Let's Encrypt — không cần config gì thêm.
Hai loại domain
Subdomain Zeni miễn phí
myapp.zenicloud.io
- Free tier có sẵn
- SSL wildcard tự động
- Setup tức thì, không cần DNS
- Phù hợp test, MVP
Custom domain riêng
yourapp.com
- Yêu cầu gói Starter trở lên
- SSL Let's Encrypt + Google Trust
- Mất 5-30 phút verify DNS
- Phù hợp production thật
Tạo subdomain Zeni miễn phí
Trong dashboard, mở service Cloud Run của bạn:
- Vào
Compute→ chọn service - Tab
Domains→ Add Zeni subdomain - Nhập tên — ví dụ
myappsẽ thànhmyapp.zenicloud.io - Bấm Save — domain hoạt động ngay sau 30 giây
Hoặc qua API:
bashcurl -X POST "https://zenicloud.io/api/v1/domains?ws=prod" \
-H "Authorization: Bearer $ZENI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "zeni_subdomain",
"subdomain": "myapp",
"service_id": "svc_8f3a9b1c"
}'
Map custom domain riêng
Bước 1 — Thêm domain vào Zeni
bashcurl -X POST "https://zenicloud.io/api/v1/domains?ws=prod" \
-H "Authorization: Bearer $ZENI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "custom",
"domain": "app.yourcompany.vn",
"service_id": "svc_8f3a9b1c"
}'
Response chứa records DNS bạn cần config:
json{
"domain": "app.yourcompany.vn",
"status": "pending_dns",
"verification": {
"method": "dns",
"records": [
{
"type": "CNAME",
"name": "app",
"value": "ghs.zenicloud.io",
"ttl": 300
},
{
"type": "TXT",
"name": "_zeni-verify.app",
"value": "zeni-verify=a8f3b1c2d4e5f6a7"
}
]
}
}
Bước 2 — Cấu hình DNS
Đăng nhập vào nhà cung cấp domain (PA Vietnam, GoDaddy, Mắt Bão, Cloudflare...):
Subdomain (app.yourcompany.vn)
| Type | Name | Value | TTL |
|---|---|---|---|
| CNAME | app | ghs.zenicloud.io | 300 |
| TXT | _zeni-verify.app | zeni-verify=a8f3b1c2... | 300 |
Apex domain (yourcompany.com)
Apex không cho dùng CNAME, phải dùng A/AAAA record:
| Type | Name | Value | TTL |
|---|---|---|---|
| A | @ | 216.239.32.21 | 300 |
| A | @ | 216.239.34.21 | 300 |
| A | @ | 216.239.36.21 | 300 |
| A | @ | 216.239.38.21 | 300 |
| AAAA | @ | 2001:4860:4802:32::15 | 300 |
Bước 3 — Verify
Sau khi DNS propagation (5 phút - 24 giờ), Zeni tự verify. Bạn có thể trigger thủ công:
bashcurl -X POST "https://zenicloud.io/api/v1/domains/app.yourcompany.vn/verify?ws=prod" \
-H "Authorization: Bearer $ZENI_TOKEN"
Khi thành công:
json{
"domain": "app.yourcompany.vn",
"status": "active",
"ssl_status": "issuing",
"verified_at": "2026-04-30T10:25:00Z"
}
Bước 4 — Đợi SSL cấp
Sau khi verify DNS, Zeni gửi yêu cầu Let's Encrypt cấp SSL. Mất 1-15 phút. Khi ssl_status đổi thành active, domain đã sẵn sàng phục vụ HTTPS.
Kiểm tra trạng thái
bashcurl "https://zenicloud.io/api/v1/domains?ws=prod" \
-H "Authorization: Bearer $ZENI_TOKEN"
json{
"domains": [
{
"domain": "app.yourcompany.vn",
"type": "custom",
"status": "active",
"ssl_status": "active",
"ssl_expires": "2026-07-29T00:00:00Z",
"service_id": "svc_8f3a9b1c"
},
{
"domain": "myapp.zenicloud.io",
"type": "zeni_subdomain",
"status": "active",
"ssl_status": "active"
}
]
}
Khắc phục sự cố
DNS chưa propagated
Kiểm tra với dig hoặc nslookup:
bashdig app.yourcompany.vn CNAME +short
# Mong đợi: ghs.zenicloud.io.
dig _zeni-verify.app.yourcompany.vn TXT +short
# Mong đợi: "zeni-verify=a8f3b1c2..."
Nếu chưa thấy — đợi thêm 1-2 giờ. DNS Vietnam thường chậm hơn châu Âu/Mỹ.
SSL pending lâu
Let's Encrypt rate limit 5 cert/tuần cho cùng domain. Nếu fail nhiều lần:
- Đợi 7 ngày trước khi retry
- Hoặc liên hệ support để upload cert tự cấp (Enterprise)
Lỗi CAA record
Nếu domain có CAA record, phải cho phép Let's Encrypt:
dnsyourcompany.com. IN CAA 0 issue "letsencrypt.org"
yourcompany.com. IN CAA 0 issue "pki.goog"
Domain qua Cloudflare proxy
Nhiều domain cho 1 service
Một service Cloud Run có thể bind nhiều domain — ví dụ app.com, www.app.com, app.com.vn đều trỏ đến cùng service:
bashfor d in app.com www.app.com app.com.vn; do
curl -X POST "https://zenicloud.io/api/v1/domains?ws=prod" \
-H "Authorization: Bearer $ZENI_TOKEN" \
-d "{\"type\":\"custom\",\"domain\":\"$d\",\"service_id\":\"svc_xyz\"}"
done
Redirect www → apex
Để gọn URL canonical, redirect www sang apex:
bashcurl -X POST "https://zenicloud.io/api/v1/domains/www.app.com/redirect?ws=prod" \
-H "Authorization: Bearer $ZENI_TOKEN" \
-d '{"target":"https://app.com","code":301}'
Chi phí
- Subdomain Zeni — miễn phí, không giới hạn
- Custom domain — bao gồm trong gói Starter+
- SSL — luôn miễn phí (Google + Let's Encrypt)
Bước tiếp theo
- Cost Dashboard — theo dõi traffic theo domain
- Webhook — receive event với custom domain riêng