Общая конфигурация
Ниже приведен пример общей конфигурации, а в последующих разделах раскрываются примеры конфигурации каждого из разделов.
http resource json object (HRJO) – data from request/responseHRJO structure and keys:{id <string> - uid of resource (used in api url)name <string> - identificator for web UI (required)origin <json> - section for traffic origin description (required)certificate <integer> - id of created certificatenames <json> - section for names descriptionrobots <json> - section for robots file descriptionheaders <json> - section for specific headers descriptioncache <json> - section for cache options descriptionclient_cache <json> - section for extra cache options descriptionauth <json> - section for auth options descriptioncors <json> - section for cors descriptionlimitations <json> - section for geo, ip, referer or useragent limitationsmodern_tls_only <boolean> - use only modern versions of TLSstrong_ssl_ciphers <boolean> - use strong SSL ciphers (required modern_tls_only)locations <json> - section for locations descriptioncompress <json> - section for compress options descriptionioss <boolean> - section for ioss options descriptionpackaging <json> - section for packaging options descriptiontuning <string> - distribution optimization type (one of "default", "large" (for large files > 20 Mbytes), "live" (for HTTP LIVE streams))slice_size_megabytes <integer> - size of slice in MB (only for tuning="large")}
origin section
{https <boolean> – use or not https during requests to originssl_verify <boolean> - check or not certificate during requests to origin (required https)s3_bucket <string> - permitted bucket, set when specifying S3-domainaws <json> - use aws authorization during requests to originhostname <string> – set host header during requests to originservers <json> – client nodes descriptionread_timeout <string> – time in seconds, e.g. "10s"send_timeout <string> – time in seconds, e.g. "10s"connect_timeout <string> – time in seconds, e.g. "10s"}
aws section
{auth <json> - authorization keys}
aws auth section
{access_key <string> - access keysecret_key <string> - secret key}
servers section
{<client_domain/ip_address>: client node address <json>}
client node address section
{port <integer> – client node port (default 80 and 443)weight <integer> – load balancing parametersmax_fails <integer> – load balancing parametersbackup <boolean> – use node only in backup mode}
names section
list of string cnames, f.e. ["alias1.client.cdn.ru"]
robots section
{type <string> - "deny", "custom" or "cached"robotsContent <string> - client’s robots.txt text (only for "custom" type)}
headers section
{request <json> – headers for requests to originresponse <json> – header for customer responses}
request headers section
{<header_name>: <header_value>}
response headers section
{<header_name>: <header_value>}
cache section
{disable <boolean> – do not cache contentconsider_args <boolean> – use querystring while cache processvalid <json> – time of caching}
valid section
{2xx <string> – cache ttl for 2xx response codes3xx <string> – cache ttl for 3xx response codes4xx <string> – cache ttl for 4xx response codes5xx <string> – cache ttl for 5xx response codesforce <boolean> – force cache update on clientside}
client cache section
{expires <integer> – expire cache time}
cors section
{disable <boolean> – disable cors (default: false)domains <list of strings> – list of allowed domainsheaders <list of strings> – list of secure request headers (Accept, Accept-Language, Content-Type, Content-Language are allowed by default)expose <list of strings> – list of upper level API accessible headers (Cache-Control, Content-Language, Content-Type, Expires, Last-Modified, Pragma are allowed by default)methods <list of strings> – list of safe methods (GET, HEAD, POST are allowed by default)max_age <integer> – preflight request response lifetimecredentials <boolean> – set an Access-Control-Allow-Credentials header}
compress section
{brotli <boolean> – use data compression format Brotli}
limitations section
{geo <list> - list of rules for limitation by countries and regionsip <list> - list of rules for limitation by ip addressesreferer <list> - list of rules for limitation by refereruseragent <list> - list of rules for limitation by useragent}
limitations rules section
{default_action <string> - "allow" or "deny"exclude <list> - list of exclusionstimes <list> - list of time intervals}
limitations rules times section
{start <string> - start of time interval in ISO 8601-1:2019 extended format or nullend <string> - end of time interval in ISO 8601-1:2019 extended format or null}
limitations geo exclude section
{country <string> - country code in ISO 3166-1 alpha-2region <string> - region code in ISO 3166-2 or nullaction <string> - "deny" or "allow"}
limitations referer exclude section
{referer <string> - domain name or regular expression}
limitations ip exclude section
{ip <string> - IP address to exclude in CIDR notation}
limitations useragent exclude section
{useragent <string> - user agent or regular expression}
locations section
{key <string> – path to content: locations params <json>}
locations params section
{headers <json> – like global sectioncache <json> – like global sectionclient_cache <json> – like global sectionauth <json> – like global sectioncors <json> – like global sectioncompress <json> – like global sectionioss <boolean> - like global sectionlimitations <json> - like global sectionpackaging <json> - like global section}
packaging params section
{<format> <json> - options for the video <format> from the list: mp4}
packaging format params section
{output_protocols <list of strings> - list of formats in which the video will be distributed (HLS, MPEG-DASH)}
Была ли статья полезной ?
Предыдущая статья
API для HTTP-ресурса
Следующая статья
Минимальная конфигурация