-
Get a certificate for your domain in Web Certificates, in the project the distribution will be in, and wait until it’s issued. With the domain’s zone in EZGH DNS,
--dns-zone autocreates the validation records for you; otherwise add the recordsezgh certificates getshows:ezgh certificates request example.com '*.example.com' --name example-com --dns-zone auto --wait -
Create the distribution, with its origin and your domain:
ezgh cdn distributions create --name shop \ --origin-host shop-lb.example.com \ --domain www.example.com=crt_2m9x0a7qpe4kIts
defaultHostname, such asd4k2m9x0a7qpe.ezghcdn.com, serves at once. Check your site there first:curl https://d4k2m9x0a7qpe.ezghcdn.com/. -
Create a CNAME record from your domain to the default hostname:
Name Type Value www.example.comCNAMEd4k2m9x0a7qpe.ezghcdn.comA zone’s apex (
example.com) can’t hold a CNAME; serve it fromwwwand redirect, or use your DNS provider’s CNAME flattening. -
Wait for
statusto bedeployed, then check it answers:ezgh cdn distributions get cdn_4k2m9x0a7qpe curl https://www.example.com/cdn-cgi/trace
In the API, CreateDistribution takes the same:
{
"name": "shop",
"origin": { "host": "shop-lb.example.com", "protocol": "https" },
"domains": [{ "hostname": "www.example.com", "certificateId": "crt_2m9x0a7qpe4k" }]
}To add a domain later, read the distribution with GetDistribution,
add it to domains, and send the whole document to UpdateDistribution
with the ETag you read as If-Match, or run
ezgh cdn distributions update cdn_4k2m9x0a7qpe --domain www.example.com=crt_2m9x0a7qpe4k --domain shop.example.com=crt_2m9x0a7qpe4k
(--domain replaces the list).