Quick Start - Advanced Cache Control Script
By Default, the Reverse Proxy configurations will use your Origin's Cache Control header for setting the TTL ( time to live ) cache life of the content on the CDN.
If your origin does not provide a Cache Control Header, the one TTL value specified in the Reverse Proxy settings is used.
Also, for the Reverse Proxy Configurations, you either ignore all query parameters or cache uniquely by All query parameters. With that easy query string check box for Reverse Proxy, it is all or nothing with regard to query string parameters caching.
ACC More Granular Control
But what if you need more granular control or more complex configurations....
The Advanced Cache Control script gives you the flexibility to define this granularity.
You can do things such as:
Override the Cache Control Header from origin
Set a different TTL for the browser than what is set on the CDN.
Vary only by certain query parameters
Specify if query parameters are passed through to origin
Set TTLs based on paths or pathfilters
Set TTLs based on file extensions ( for example .jpg, or .m3u8 )
and so much more....
Sample Advanced Cache Control Script
Sample Advanced Cache Control Script:
default:
caching:
mode: respect-origin-assume-cache
cdnTtl: 86400
browserTtl: 86400
varyByQuery: false
liveStreams: true
exceptions:
- path: /
extensions:
- jpg
caching:
mode: ignore-origin-and-cache
browserTtl: 3800
cdnTtl: 8000
- path: /
extensions:
- m3u8
caching:
mode: ignore-origin-and-cache
cdnTtl: 5
cacheControlHeader: "no-cache, no-store, must-revalidate"
varyByQuery:
- placeholder
passQuery: ALL
liveStreams: true
- path: /
extensions:
- ts
caching:
mode: ignore-origin-and-cache
cdnTtl: 3600
browserTtl: 3600
varyByQuery: false
liveStreams: true
- path: /
extensions:
- php
caching:
mode: never-cache
cacheControlHeader: "no-cache"
varyByQuery: true
liveStreams: true
- path: /
pathFilter:
- /*/drv-*
caching:
mode: ignore-origin-and-cache
cdnTtl: 604800
browserTtl: 604800
varyByQuery:
- version
liveStreams: false
Configuration Help
Cache Control Mode: Note with above script, modes allow for respecting cache control from origin, or completely overriding the origin's cache control header.
mode: respect-origin-assume-cache
mode: ignore-origin-and-cache
Also, never-cache can be configured for fully dynamic content, to act as full proxy for certain paths or extensions. This also will pass through all query parameters or cookies.
mode: never-cache
Browser TTL can be set as a time in seconds, or also using the cacheControlHeader: to configure the cache control sent to the end user.
browserTtl: 3600
cacheControlHeader: "no-cache, no-store, must-revalidate"
Vary By Query Parameter Settings:
When set to false, this caches uniquely by no query parameters, and also does not pass query strings to origin.
varyByQuery: false
When set to true, this caches uniquely by all query parameters, and sends all parameters to origin.
varyByQuery: true
Specifying a value will cache uniquely by the specified query parameter only.
varyByQuery:
- version
If you want to pass all query parameters to origin, but uniquely cache on none, use a a non-existent query parameter for your list
varyByQuery:
- placeholder
The passQuery config gives you more control on which query parameters are sent to your origin.
If the passQuery feature is not working as expected, you may need to contact support to update your ACC script version.
passQuery: All
passQuery: None
passQuery: Match
Pathfilter: The Path config requires the path to start with that value, but the pathFilter option allows you to define filtering within that path and also supports wildcards.
(Note - It does not currently support regex.)
- path: /
pathFilter:
- /*/drv-*
These are just a few examples of how using the Advanced Cache Control script can give you more granularity with regard to the CDN caching of your content.
More Info
For more information -
Initially setting up your script - Advanced Cache Control ( ACC ) Script Setup