Skip to main content
Table of contents

Using Expiry Overrides

The Expiry Overrides option allows you to configure expiration information for a CacheFly service. Setting expiration information (in increments of seconds, for example, 86400 seconds for 1 full day) sets both Expire and Cache-control: max-age headers.

To override expiry times for a given service, first navigate to that service (Configuration > Services > [SERVICE NAME]).

  • On the left of the screen, click on OPTIONS to expand the list of options available.

  • Click on Expiry Overrides in the list of OPTIONS for the service or scroll down to display the Expiry Overrides section.

  • In this section, click on + Add Rule to define an expiry override. A popup window appears for you to define a rule using all three of the following parameters (see also below for more information):

    • Match Directory

    • File Extension

    • Expiry Period

  • Click the Create New Rule button. The new rule is added to the Rules list in this section (this list appears when the first rule is created).

Directories

Directories match any subdirectories below them. For example, a rule defined with /images will also match /images/logos/small

Using a directory of / with no extension will mean a default expiration time to apply to all files with the file extension(s) specified below.

File Extensions

For example, to match all jpeg files in the directory specified above, enter jpg as the extension. To match all files, leave this field empty.

Expiry Period

Longer expiry periods improve performance for end-users, but also increase the time for users to detect changes to files.

Scroll the graphics in this step horizontally to see all the screens.

Ordering of Expiry Override Rules

The CacheFly CDN platform uses a first match wins system.

For example, the following order of rules ensures all three rules are applied, from the most specific one first, to the most general/default rule last:

First Rule

for /images/*.jpg set expire time to 14400s

Second Rule

for /images/* set expire time to 86400s

Third Rule

set expire time to 604800s

In other words:

  • First, an expiration time of 4 hours (14400 seconds) is applied for jpeg files in /images

  • Next, for any other file type in /images, the expiration time is 1 day

  • Finally, for files outside of /images, the expiration time is 1 week

However, changing the order of the first and second rules will produce a different effect:

First Rule

for /images/* set expire time to 86400s

Second Rule

for /images/*.jpg set expire time to 14400s

Third Rule

set expire time to 604800s

Now, the first rule now applies to ALL file types in the /images directory. That means that the second rule defined for a subset of these file types in the same directory will never be applied.

And if the default rule set expire time to 604800s became the first rule, instead of being the third rule, the difference would be even greater: neither of the other two rules would ever be applied.

So, be sure to order your rules correctly to get the effect that you want.

Managing Expiry Override Lists

You can edit or delete each rule in an Expiry Overrides list, using the pencil and Recycle Bin/trashcan icons displayed for that rule.

Scroll the graphics in this step horizontally to see all the screens.