Skip to main content

Rule examples: DASH

MPEG-DASH delivers adaptive streaming through an XML manifest (.mpd) that references fragmented MP4 segments (.m4s). As with HLS, the manifest must stay fresh while segments can be cached a little longer. This page provides a template of cache rules and a CORS header rule tuned for DASH players such as dash.js.

Manifest vs. segment TTLs

A live .mpd is updated as the presentation advances, so it needs a very short TTL. The .m4s segments are immutable once published and can be cached longer to offload the origin.

File typePattern (case-insensitive regex)TTLWhy
Manifest (MPD)~* \.(mpd)$2 secondsMust stay fresh; the live presentation advances.
Media segment~* \.(m4s)$10 secondsImmutable within the rolling window.
tip

DASH and HLS share the same caching philosophy: short TTL on the manifest, modest TTL on the segments. If you serve both protocols from one property, use the combined manifest pattern below so a single rule covers .m3u8 and .mpd.

Manifest cache rule

Use the Regex match type (matchType: 4) so the case-insensitive .mpd pattern applies.

{
"name": "DASH manifest",
"pattern": "\\.(mpd)$",
"matchType": 4,
"ttlSeconds": 2,
"description": "Keep DASH manifest fresh",
"order": 1,
"isEnabled": true
}
curl -X POST 'https://api.paradarum.com/api/Property/42/rules/cache' \
-H 'X-Api-Key: pdm_YOUR_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "DASH manifest",
"pattern": "\\.(mpd)$",
"matchType": 4,
"ttlSeconds": 2,
"description": "Keep DASH manifest fresh",
"order": 1,
"isEnabled": true
}'

Segment cache rule

{
"name": "DASH segment",
"pattern": "\\.(m4s)$",
"matchType": 4,
"ttlSeconds": 10,
"description": "Immutable DASH segments",
"order": 2,
"isEnabled": true
}
curl -X POST 'https://api.paradarum.com/api/Property/42/rules/cache' \
-H 'X-Api-Key: pdm_YOUR_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "DASH segment",
"pattern": "\\.(m4s)$",
"matchType": 4,
"ttlSeconds": 10,
"description": "Immutable DASH segments",
"order": 2,
"isEnabled": true
}'
note

The .m4s segment extension is shared by HLS (with fragmented MP4 / CMAF) and DASH. A single segment rule with pattern \.(ts|m4s)$ therefore covers both protocols when you serve them side by side.

Serving HLS and DASH together

If one property delivers both protocols, collapse the two manifest rules into one with a combined pattern so a single rule keeps every playlist fresh:

{
"name": "Live manifest (HLS + DASH)",
"pattern": "\\.(m3u8|mpd)$",
"matchType": 4,
"ttlSeconds": 2,
"description": "Fresh HLS and DASH manifests",
"order": 1,
"isEnabled": true
}

This ~* \.(m3u8|mpd)$ pattern is exactly what Paradarum uses for the system manifest rule on managed live properties.

CORS header rule for dash.js

dash.js loads the manifest and segments over fetch/XHR, so the responses need a permissive CORS header. Add a response header rule with the Set action (action: 1), an empty pattern (global), and applyToRequest: false.

{
"name": "DASH CORS",
"pattern": "",
"matchType": 1,
"action": 1,
"headerName": "Access-Control-Allow-Origin",
"headerValue": "*",
"applyToRequest": false,
"order": 3,
"isEnabled": true
}
curl -X POST 'https://api.paradarum.com/api/Property/42/rules/header' \
-H 'X-Api-Key: pdm_YOUR_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "DASH CORS",
"pattern": "",
"matchType": 1,
"action": 1,
"headerName": "Access-Control-Allow-Origin",
"headerValue": "*",
"applyToRequest": false,
"order": 3,
"isEnabled": true
}'
info

action: 1 is Set/Replace. Use a specific origin instead of * to restrict which sites may embed your dash.js player.

A note on Paradarum Live properties

When you publish via Paradarum Live, the backing CDN property already carries equivalent system rules: a combined ~* \.(m3u8|mpd)$ manifest rule (TTL 2s), a ~* \.(ts|m4s)$ segment rule (TTL 10s), and an Access-Control-Allow-Origin: * CORS rule. They are read-only on the managed property. Use the templates here only for custom DASH delivery on a standard property. See live playback and caching.

See also