Skip to main content
Contents

Caching rules

CDNify is a pull CDN: the first request for a file is sent to your origin, and the edge location keeps a copy for the following visitors until its cache lifetime ends.

Cache lifetime

Your origin decides how long content is cached through its caching headers. The default cache lifetime of the site (cache_ttl_seconds) applies when the origin sends none.

Choose a long lifetime for files that never change at the same URL, such as versioned scripts and images, and purge when you replace a file at the same URL.

Query strings

By default, each query string is cached separately. Turn on Ignore query strings (cache_ignore_query_string) when the query string does not change the content, so that URLs that differ only in their query string share one cached copy.

Delivery settings

Each site has these delivery settings, in the portal and in the settings of the API:

  • Compress responses (compression_enabled): text-based content is compressed before it is sent to visitors.
  • Add CORS headers (cors_enabled): browsers on other origins can load fonts and other assets from the site.
  • Redirect visitors to HTTPS (force_https): requests received over HTTP are redirected to HTTPS.
  • Stop search engines from indexing the CDN hostname (robots_disallow_all): a robots.txt file that disallows crawling is served.
  • Add a canonical link header (canonical_link_header): search engines are told that the original copy of each asset lives on your origin.
Request: Update a site
curl -X PATCH 'https://api.cdnify.lat/api/v2/sites/site_0a1b2c3' \
  -H "Authorization: Bearer $CDNIFY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"settings":{"cache_ttl_seconds":86400,"cache_ignore_query_string":true}}'

API reference: Update a site

How changes are applied

Every change creates a new configuration revision of the site, which is deployed to every edge location. The deployments view shows which revision each location serves.

The cache is emptied only when a change affects the cache key or the origin. Other changes keep the cached copies.

Next steps