ezgh cdn distributions create --name <name> (--origin-host <host> [--origin-protocol https|http] [--origin-port p] [--host-header viewer|origin] | --origin-bucket <bucket>) [--domain hostname=crt_…]… [--rewrite pattern=/replacement]… [--waf waf_…] [flags]Create a distribution in front of an origin. Its default hostname serves at once; each --domain needs a Web Certificates certificate in the project that covers it, and certificates.certificates.use on it. Then create a CNAME record from each domain to the default hostname.
For a single-page app, --rewrite ‘^/[^.]*$=/index.html’ serves the app for every path without a file extension. The visitor’s URL and query string don’t change.
It shows as deploying until every location has it, then deployed.
Part of ezgh cdn distributions.
Examples
ezgh cdn distributions create --name shop --origin-host shop-lb.example.com
ezgh cdn distributions create --name shop --origin-host origin.example.com --origin-protocol http --origin-port 8080 \
--domain www.example.com=crt_2m9x0a7qpe4k
ezgh cdn distributions create --name assets --origin-bucket shop-assets
ezgh cdn distributions create --name app --origin-bucket app-build --rewrite '^/[^.]*$=/index.html'Flags
| Flag | Type | Default | Description |
|---|---|---|---|
--description |
string | what it’s for (“” removes it) | |
--domain |
string, repeatable | a domain and the Web Certificates certificate that covers it, hostname=crt_…; repeat for more (at most 10) | |
--host-header |
string | the Host header the origin gets: viewer (the visitor’s) or origin (its host) (default viewer) | |
--name |
string | its name | |
--origin-bucket |
string | instead of --origin-host: an Object Storage bucket of this organization, by name, read privately; the bucket’s settings must list the distribution (ezgh objects buckets settings --cdn-distribution) |
|
--origin-host |
string | the origin’s hostname or IPv4 address, on the internet | |
--origin-port |
int | the origin’s port (default 443 for https, 80 for http) | |
--origin-protocol |
string | http or https; with https the origin’s certificate must be valid for its host (default https) | |
--rewrite |
string, repeatable | a path rewrite, pattern=/replacement: a request whose path matches the regular expression is sent to the origin as the replacement path ($1 is the first capture group); repeat for more, tried in order (at most 10) | |
--tag |
string, repeatable | a tag, key=value; repeat for more | |
--waf |
string | an EZGH WAF in the project, waf_…, that inspects every request before the origin (needs waf.wafs.attach) |
This command also takes the global flags.