All Products
Search
Document Center

CDN:Built-in functions

Last Updated:Apr 01, 2026

EdgeScript built-in functions cover the full range of edge-node operations — from inspecting request metadata and rewriting URLs to encrypting data and controlling cache TTL. The following table lists all 13 function categories and the functions available in each.

CategoryDescriptionFunctions
Logical functionsEvaluate and combine boolean conditionsand, or, not, eq, ne, null
Numeric functionsPerform arithmetic operations and numeric comparisonsadd, sub, mul, div, mod, gt, ge, lt, le, floor, ceil
String functionsManipulate, match, and convert string valuessubstr, concat, upper, lower, len, byte, match_re, capture_re, gsub_re, split, split_as_key, tohex, tostring, tochar, reverse, find, format, tobin, trim
Dictionary functionsRead and write key-value dictionary entriesset, get, foreach, del
Request processing functionsModify request and response headers, rewrite URLs, and control outputadd_req_header, del_req_header, add_rsp_header, del_rsp_header, encode_args, decode_args, rewrite, say, print, exit, get_rsp_header, add_rsp_cookie
Throttling functionsLimit the rate at which data is sent to clientslimit_rate_after, limit_rate
Cache functionsOverride the cache TTL for edge-node responsesset_cache_ttl
Time functionsGet and convert timestamps in various formatstoday, time, now, localtime, utctime, cookie_time, http_time, parse_http_time, unixtime
Cipher algorithm functionsEncrypt, decrypt, and hash data using AES, SHA, HMAC, and MD5aes_new, aes_enc, aes_dec, sha1, sha2, hmac, hmac_sha1, md5, md5_bin
JSON functionsEncode and decode JSON datajson_enc, json_dec
Miscellaneous functionsEncode and decode data using Base64 and URL encoding, generate random values, and compute checksumsbase64_enc, base64_dec, url_escape, url_unescape, rand, rand_hit, crc, tonumber, base64_enc_safe, base64_dec_safe, randomseed
Array functionsCreate and manipulate arraysarr_concat, arr_insert, arr_remove, arr_sort, arr_len
Request logic functionsInspect request metadata including client IP address, ISP, geographic location, URI, headers, and cookiesserver_addr, server_port, client_addr, client_country, client_region, client_isp, ip_country, ip_region, ip_isp, req_uri, req_uri_basename, req_uri_ext, req_uri_seg, req_uri_arg, req_uri_query_string, req_scheme, req_method, req_host, req_user_agent, req_referer, req_cookie, req_first_x_forwarded, req_header, req_id