API: Proxy and speed

Read every service at once, choose the nodes per domain or per name, and turn compression and minifying on.

GET /domains/{domain}/services services.read

Read the services

The proxy and CDN settings of the domain as the portal shows them: nodes, ssl, cdn, optimize, attack and waf, each with whether the plan includes it and the allowed choices.

curl -H "Authorization: Bearer $KEY" \
  https://my.cloud9.ir/api/customer/v1/domains/example.com/services
POST /domains/{domain}/services/nodes proxy.nodes

Choose the nodes

Which nodes answer the domain's proxied names.

Body fieldValuesMeaning
valueRequired geo | iran | foreign | all | zone geo: nearest node by visitor location; iran or foreign: only those nodes; all: every node; zone (with host): follow the domain.
host Text One proxied name; without it every name of the domain changes. For nodes, value zone makes the name follow the domain again.
curl -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"value":"geo"}' https://my.cloud9.ir/api/customer/v1/domains/example.com/services/nodes
POST /domains/{domain}/services/nodes proxy.nodes

Backup server of a name

When the servers of a proxied name do not answer, the nodes send its visitors to the backup server you give (a second copy of the site), within a minute. Send an empty backup to remove it.

Body fieldValuesMeaning
hostRequired Text The proxied name, such as shop or @.
backupRequired Text Public IP addresses of the backup server, separated by spaces or commas; empty removes it.
field backup backup: send it with an empty backup to remove the backup server.
curl -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"host":"shop","backup":"198.51.100.20"}' https://my.cloud9.ir/api/customer/v1/domains/example.com/services/nodes
GET /domains/{domain}/speed-test services.read

Speed test results

The last speed test and the history.

curl -H "Authorization: Bearer $KEY" \
  https://my.cloud9.ir/api/customer/v1/domains/example.com/speed-test
POST /domains/{domain}/speed-test speed

Run a speed test

Fetches a page through the nodes and straight from your server, cold and warm; at most once in two minutes (429).

Body fieldValuesMeaning
host Text The proxied name to test.
path Text The page path (default /).
label before | after before or after a change.
curl -X POST -H "Authorization: Bearer $KEY" \
  https://my.cloud9.ir/api/customer/v1/domains/example.com/speed-test
GET /domains/{domain}/error-pages domain.settings

Own error pages

Whether the plan allows them, the kinds and your current pages; services.read may read them too.

curl -H "Authorization: Bearer $KEY" \
  https://my.cloud9.ir/api/customer/v1/domains/example.com/error-pages
PUT /domains/{domain}/error-pages domain.settings

Set own error pages

One HTML string per kind you send; an empty string brings back the built-in page. Scripts are removed.

Body fieldValuesMeaning
origin Text HTML when your server does not answer.
blocked Text HTML for a blocked visitor.
waf Text HTML when the firewall stops a request.
limited Text HTML when the request limit is reached.
challenge Text HTML around the attack check.
curl -X PUT -H "Authorization: Bearer $KEY" \
  https://my.cloud9.ir/api/customer/v1/domains/example.com/error-pages
POST /domains/{domain}/services/optimize speed

Compression and minifying

gzip and Brotli compression and minifying of CSS, JavaScript and HTML on the nodes.

Body fieldValuesMeaning
compress 1 | 0 gzip and Brotli compression.
minify_css 1 | 0 Minify CSS.
minify_js 1 | 0 Minify JavaScript.
minify_html 1 | 0 Minify HTML.
curl -X POST -H "Authorization: Bearer $KEY" \
  https://my.cloud9.ir/api/customer/v1/domains/example.com/services/optimize

No answer here? Sign in to the portal and open a ticket. Open a ticket