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.
| Category | Description | Functions |
|---|---|---|
| Logical functions | Evaluate and combine boolean conditions | and, or, not, eq, ne, null |
| Numeric functions | Perform arithmetic operations and numeric comparisons | add, sub, mul, div, mod, gt, ge, lt, le, floor, ceil |
| String functions | Manipulate, match, and convert string values | substr, concat, upper, lower, len, byte, match_re, capture_re, gsub_re, split, split_as_key, tohex, tostring, tochar, reverse, find, format, tobin, trim |
| Dictionary functions | Read and write key-value dictionary entries | set, get, foreach, del |
| Request processing functions | Modify request and response headers, rewrite URLs, and control output | add_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 functions | Limit the rate at which data is sent to clients | limit_rate_after, limit_rate |
| Cache functions | Override the cache TTL for edge-node responses | set_cache_ttl |
| Time functions | Get and convert timestamps in various formats | today, time, now, localtime, utctime, cookie_time, http_time, parse_http_time, unixtime |
| Cipher algorithm functions | Encrypt, decrypt, and hash data using AES, SHA, HMAC, and MD5 | aes_new, aes_enc, aes_dec, sha1, sha2, hmac, hmac_sha1, md5, md5_bin |
| JSON functions | Encode and decode JSON data | json_enc, json_dec |
| Miscellaneous functions | Encode and decode data using Base64 and URL encoding, generate random values, and compute checksums | base64_enc, base64_dec, url_escape, url_unescape, rand, rand_hit, crc, tonumber, base64_enc_safe, base64_dec_safe, randomseed |
| Array functions | Create and manipulate arrays | arr_concat, arr_insert, arr_remove, arr_sort, arr_len |
| Request logic functions | Inspect request metadata including client IP address, ISP, geographic location, URI, headers, and cookies | server_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 |