Skip to content
Docs

CDN configuration

Fine-tune your CDN behaviour with presets, caching rules and image optimisation settings.

Configuration presets

Start with a preset optimised for your use case, then customise as needed.

  • Static Website: long cache times for assets, short for HTML. Perfect for blogs, marketing sites and documentation.
  • E-commerce: optimised for product catalogues with frequent updates. Caches images aggressively, bypasses cart/checkout.
  • Media & Streaming: large file handling with long TTLs. Ideal for video platforms, podcasts and file downloads.
  • API Gateway: minimal caching with origin pass-through. Good for APIs that need the CDN's global network without caching.
  • Custom: full control with JSON configuration. Define your own caching rules and image optimisation settings.
Configuration options when creating a deployment
Configuration options when creating a deployment

Custom configuration

For advanced use cases, you can define custom rules using JSON. Switch to Advanced (JSON) mode in the Configuration tab.

JSON
{
  "caching": {
    "defaultTtl": 86400,
    "respectOriginHeaders": true,
    "rules": [
      { "path": "/static/**", "ttl": 31536000 },
      { "path": "/api/**", "bypassCache": true },
      { "path": "/assets/*.css", "ttl": 604800 }
    ]
  },
  "imageOptimization": {
    "enabled": true,
    "defaultQuality": 85,
    "defaultFormat": "auto",
    "rules": [
      { "path": "/thumbnails/**", "quality": 70, "maxWidth": 400 },
      { "path": "/hero/**", "quality": 90, "format": "avif" }
    ]
  }
}

Caching rules

Define path-based rules to control how different content is cached.

PropertyTypeDescription
pathstringPath pattern to match (supports * and ** wildcards)
ttlnumberCache duration in seconds
bypassCachebooleanSkip caching entirely for matched paths
ignoreQueryStringbooleanCache without considering query parameters

Note

Rules are evaluated in order. The first matching rule wins. If no rules match, the default TTL is used.

Path patterns

Use glob-style patterns to match paths:

  • *: matches any characters except /
  • **: matches any characters including /
Output
# Match all files in /static/ and subdirectories
/static/**

# Match only .jpg files in /images/
/images/*.jpg

# Match a specific path
/assets/logo.png

# Match all API routes
/api/**

Image optimisation settings

Configure default image optimisation behaviour and path-specific rules.

PropertyTypeDescription
enabledbooleanEnable/disable image optimisation entirely
defaultQualitynumber (1–100)Default compression quality for images
defaultFormatstringDefault output format: auto, webp, avif, jpeg, png

Tip

Auto format. Set defaultFormat to auto to automatically serve the best format based on browser support. The CDN checks the browser's Accept header and serves AVIF → WebP → JPEG in order of preference.

Warning

Cache purge required. Changing defaultQuality or defaultFormat only affects newly cached images. Existing cached images continue to use the old settings until they expire or you purge the cache.

Image optimisation rules

Override image optimisation settings for specific paths:

PropertyTypeDescription
pathstringPath pattern to match
qualitynumberOverride compression quality
formatstringOverride output format
maxWidthnumberMaximum width in pixels

Simple vs advanced mode

Simple mode

Use form controls to set basic options:

  • Default cache TTL
  • Enable/disable image optimisation
  • Default quality and format

Advanced mode

Full JSON configuration for:

  • Path-based caching rules
  • Cache bypass for specific paths
  • Per-path image optimisation rules

Next steps

Something unclear or out of date? Tell us, or read this page as Markdown.