Cache CSS/JS aggressively
Cache static files for a day or longer with Cache for a fixed time, and leave campaign tracking parameters out of the cache key.
CDN.com.tr Help
On the Rules tab of Domains & Rules, a rule picks requests by domain, protocol and path, then sets how they are cached, which headers are added or removed, where they are fetched from and who may open them.
Cache, security, WAF, and purge
On the Rules tab of Domains & Rules, a rule picks requests by domain, protocol and path, then sets how they are cached, which headers are added or removed, where they are fetched from and who may open them.
These examples use safe WordPress-origin scenarios for static files, query strings, headers/cookies, and sensitive session paths.
Cache static files for a day or longer with Cache for a fixed time, and leave campaign tracking parameters out of the cache key.
Choose Don't cache this path for wp-admin and wp-login; on cached paths, skip the cache when a session or cart cookie is present.
Have the edge ignore Set-Cookie or Cache-Control from your origin when it caches, remove X-Origin-Debug/X-Powered-By before responses reach browsers, and switch on Debug headers only while testing.
For API-like paths, keep only the query parameters that change the content in the cache key, and set a limit of requests per visitor IP.
In the Origin row, choose Fetch from a folder on the origin and enter, for example, /wp-content/site-root/apple/: requests matching this rule are fetched from that folder on the origin. The visitor's address does not change; the cache key and the purge path stay the visitor's path. Only for Starts with paths.
www.example.com instead of real customer domains.Narrow the rule by domain, protocol and path before changing behavior; a rule for All paths needs deliberate review.
Keep query parameters in the cache key only when they change the content; tracking parameters usually get removed.
lang or v.Personalized, cart, and admin content should bypass cache; static and anonymous content can receive TTL.
Ignoring an origin header for cache decisions is different from hiding it from the client.
The Optimization, Caching and Security tabs set account-wide behavior; a rule sets precise behavior for some domains and paths.
Expected result: The New rule editor opens within the selected account.
cdnctl accounts list
export ACCOUNT_UUID=<selected_account_uuid>
These fields decide which requests the rule matches; an overly broad regex can change the whole site.
Expected result: The rule matches only the target hostname and paths.
cat > rule-static-assets.json <<EOF
{"server_domain_names":["www.example.com"],"type":["http","http2"],"path_regex":"^/cdn-help/rules/(cache-demo\\.css|query-demo\\.json)$"}
EOF
For static files, remove tracking query parameters from the cache key and keep only real variants.
Expected result: Anonymous CSS/JSON objects are cached without splitting cache by unnecessary query parameters.
jq '. + {"cache_query_mode":"ignore_list","cache_query_params":["utm_*","gclid","fbclid","msclkid"],"cache_valid_time":"1 day","allowed_cache_methods":["GET","HEAD"],"allowed_cache_responses":["200","301","302","304"],"response_cache_times":{"200":"1 day","301":"1 week","302":"2 hours","304":"1 day"}}' rule-static-assets.json > rule-static-assets-cache.json
Admin, login, cart, and checkout paths should preserve origin behavior instead of returning cache hits.
/wp-admin, wp-login.php, cart or checkout paths.Expected result: Session requests do not return shared cached content to another user.
cat > rule-wordpress-sensitive.json <<EOF
{"server_domain_names":["www.example.com"],"type":["http","http2"],"path_regex":"^/(wp-admin|wp-login\\.php|cart|checkout)(/.*)?$","bypass":"on","bypass_by_cookie":"wordpress_logged_in\nwoocommerce_cart_hash\nwp_woocommerce_session_","limit":30,"per_time":10}
EOF
Decide separately whether origin headers affect cache decisions and whether they are exposed to browsers.
Expected result: Origin headers are controlled deliberately and debug is not left enabled in production traffic.
jq '. + {"ignore_headers":["Cache-Control","Set-Cookie"],"hide_headers":["X-Origin-Debug","X-Powered-By"],"custom_headers":"X-CDN-Rule-Debug temporary","debug_upstream_headers":true,"image_optimization":"on"}' rule-static-assets-cache.json > rule-headers-debug.json
Saving a rule publishes it to the edge, so the final check is done on the public URL: path, domain, cache time and headers.
Expected result: After operation success, matching requests show the new cache/header/rate-limit behavior.
cdnctl cdn advanced-rules validate --account "$ACCOUNT_UUID" --file rule-headers-debug.json
cdnctl cdn advanced-rules create --account "$ACCOUNT_UUID" --file rule-headers-debug.json
# Both commands post the same JSON; create writes it via /api/advanced_managements/{account_uuid}/store.
curl -I "https://www.example.com/cdn-help/rules/cache-demo.css?utm_source=test"
curl -I -H "Cookie: wordpress_logged_in=redacted" "https://www.example.com/wp-admin/"
cdnctl cdn advanced-rules validate checks the same JSON without saving it, and cdnctl cdn advanced-rules create writes it through /api/advanced_managements/{account_uuid}/store; a pipeline without cdnctl can post the JSON to that API directly.WordPress admin/cart bypasses cache while static assets and anonymous JSON paths are cached deliberately.
Enable the three-mode bot verification from the Security Events page, use "Everyone" deliberately, read the pass rate.
All account-level security controls live on one Security Events page: the site-wide WAF toggle, JS Challenge bot protection, IP and country blocking, hotlink protection, request rate limiting, and link expiration. Every save deploys to the edge automatically — no separate publish step.
Two account-wide blacklists on the same panel: block whole countries by country code, or block whole networks by autonomous system number. A blocked visitor gets the branded 403 page with a Reference ID.
Close a staging site, an admin area or a private folder at the edge: on a delivery rule, ask for a username and password, let only the IP addresses you list through, or both. Requests that do not pass are answered by the edge and never reach your server.
The Always HTTPS (HSTS) switch makes the edge send Strict-Transport-Security: max-age=31536000 on HTTPS responses, so a browser that has seen your site once refuses to open it over plain HTTP for a year.
Use WAF logs to see which requests were blocked or challenged, and why.
Put the WAF in log-only mode for the whole site or for the paths you choose, for 7, 14 or 30 days. The WAF rules keep inspecting every request and write the ones they would have blocked to the logs as "would have been blocked", but block none of them. When the period ends, the account goes back to blocking by itself.
Purge a path, saved path, or the whole account and separate CDN cache from browser cache.
Every cached object is stored under a key built from the request — scheme, host, path, and query string. A purge only clears an entry when it addresses that exact key. Understanding this one idea explains nearly every "purge did not work" case.
Use the X-Proxy-Cache-MT response header to see exactly what the CDN did with a request and to verify that caching works as intended.
Protect a file so it can only be fetched with a signature you generate, valid until a moment you choose. Unsigned requests get 403, expired ones get 410.
Switch on image optimization for the account or for one delivery rule and choose WebP or WebP + AVIF: the edge converts JPEG and PNG images and sends each browser a format it accepts, while your pages keep the same image URLs.
Send requests for a domain to another domain with a permanent (301) redirect from the Redirects tab of Domains & Rules. The path and query string are kept, and Auto SSL certificate checks under /.well-known keep working.
The edge compresses text responses automatically: Brotli for browsers that support it, gzip for the others. See which method each domain uses on the Compression card and confirm it with curl.
HTTP/3 is on for every HTTPS hostname by default. Turn it off for one hostname in its details on the Domains tab of Domains & Rules when its visitors, or a network they use, have trouble with QUIC; those visitors then use HTTP/2.
Add Access-Control-Allow-Origin and the other CORS headers to a delivery rule's responses, let your origin answer preflight OPTIONS requests, and allow the methods your API uses in the WAF.