Skip to main content

Creating cache rules

You can create cache rules on VNIS and these rules will be applied to all the CDNs you have installed and activated for your domain. You do not have to create separate rules for each CDN.

To access, navigate to ' Multi CDN' > 'Cache control'.

There are two types of cache rules you can create:

  • Cache rules: tells the system which specified path/resource to cache.
  • No-cache rules: the opposite of cache rules, tells the system which specified path/resource to NOT cache.

Cache rules

On 'Cache control', select the 'Cache rules' tab, and click 'Add cache rules'.

![Figure Needed] Cache rules interface showing the add cache rules button

You can then customize the cache rule:

  • Directory: a specific path without the file and file name. The URL must have a slash ('/') in the beginning and at the end (e.g. /url_path/).
  • File extension: a specific file type. A period ('.') must be included in front of the file type (e.g. .jpg).
  • Advanced: you can include wildcards ('') in your path. The rule must include at least one asterisk (e.g. //file.jpg). Some CDNs don't support this feature.
  • Expiry: when this cache rule will expire.

![Figure Needed] Cache rule configuration dialog showing directory, file extension, advanced, and expiry options

Note: Cache rules are domain-specific. In case you specify wildcards in your URL path (e.g. *.abc.com/picture.jpg), the system will separate caching for different subdomains (e.g. separate caching for www.abc.com/picture.jpg and test.abc.com/picture.jpg).

No Cache rules

On 'Cache control', select the 'No-cache rules' tab, and click 'Add no-cache rules'.

![Figure Needed] No-cache rules tab showing the add no-cache rules button

You can then customize the no-cache rule:

  • Directory: a specific path without the file and file name. The URL must have a slash ('/') in the beginning and at the end (e.g. /url_path/).
  • File extension: a specific file type. A period ('.') must be included in front of the file type (e.g. .jpg).

![Figure Needed] No-cache rule configuration dialog showing directory and file extension options

Within the cache rule controls, there is an additional feature that allows you to adapt the cache rules set in your origin server. This feature is called 'Honor origin'.

To activate, select the 'Cache rules' tab, and click 'Add cache rules' (or 'Edit cache rule' by clicking the 'Setting' button on an existing cache rule).

Inside the dialog box, click 'Advanced settings', and then turn on the 'Honor origin' toggle switch.

![Figure Needed] Advanced settings dialog showing the Honor origin toggle switch

Honor origin is NOT available for these CDNs:

  • Alibaba Cloud
  • Alibaba DCDN
  • Cloudflare
  • Fastly
  • Telekom Malaysia CDN
  • VNCDN
  • Verizon CDN