---
title: "CDN Configuration"
description: "Configure your Edge CDN deployment with presets, caching rules, and image optimization settings."
url: https://edge.network/docs/cdn/configuration/
---

# CDN Configuration

Configuration

# CDN Configuration

Fine-tune your CDN behavior with presets, caching rules, and image optimization settings.

## Configuration Presets

Start with a preset optimized for your use case, then customize as needed.

### Static Website

Long cache times for assets, short for HTML. Perfect for blogs, marketing sites, and documentation.

### E-commerce

Optimized for product catalogs 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 CDN's global network without caching.

### Custom

Full control with JSON configuration. Define your own caching rules and image optimization settings.

Screenshot: Preset selection in the Configuration tab

## Custom Configuration

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

```
{
  "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.

| Property | Type | Description |
| `path` | string | Path pattern to match (supports * and ** wildcards) |
| `ttl` | number | Cache duration in seconds |
| `bypassCache` | boolean | Skip caching entirely for matched paths |
| `ignoreQueryString` | boolean | Cache without considering query parameters |

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 `/`

```
# 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 Optimization Settings

Configure default image optimization behavior and path-specific rules.

| Property | Type | Description |
| `enabled` | boolean | Enable/disable image optimization entirely |
| `defaultQuality` | number (1-100) | Default compression quality for images |
| `defaultFormat` | string | Default output format: `auto`, webp, avif, jpeg, png |

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.

Cache Purge Required

Changing `defaultQuality` or `defaultFormat`
only affects newly cached images. Existing cached images will continue to use the old settings until they expire or you
[purge the cache](https://edge.network/docs/cdn/purging).

## Image Optimization Rules

Override image optimization settings for specific paths:

| Property | Type | Description |
| `path` | string | Path pattern to match |
| `quality` | number | Override compression quality |
| `format` | string | Override output format |
| `maxWidth` | number | Maximum width in pixels |

## Simple vs Advanced Mode

### Simple Mode

Use form controls to set basic options:

- Default cache TTL
- Enable/disable image optimization
- Default quality and format

### Advanced Mode

Full JSON configuration for:

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

## Next Steps

[Caching Understand cache behavior in depth](https://edge.network/docs/cdn/caching) [Image Optimization URL parameters for on-the-fly transforms](https://edge.network/docs/cdn/image-optimization)
[Back to Docs](https://edge.network/docs) [Need help?](https://edge.network/support)
