V2
This document relates to the CacheFly V1 platform. For documentation relating to the CacheFly V2 platform please see our new Help Guides.
V1
The Expire Headers management system allows you to configure expiration information for your account.
At this time, only increments (+1 week, 1 month, etc) are supported, not specific dates. Setting expiration information
results in both Expire and Cache-control: max-age headers being set.
There are 3 components to configuring a rule
- Directory (required)
- Extension (optional)
- Expiry period (required)
Directories
A directory of /, with no extension, is your default rule - use with caution! Only use this if you want to set a default expiration time that would apply to all files.
Directories match any subdirectories below them, eg: a rule of /images will catch /images/logos/small
Extensions
Extensions are optional, and match the period of a file after the dot - to match all jpeg files, you would enter:
jpg
as the extension.
Expiry Period
This controls the length of the expiration headers that will be set - longer expire's result in better end-user performance, but also increase the time it
will take for users to detect changes to files.
Ordering
The delivery platform operates on a first match wins system, so be sure you order your rules properly.
Below is an example of incorrect ordering:
Since the default rule is ordered first, all requests will have an expire time of 1 week, as every request will be matched.
The default rule should always be last (or non-existent if you don't want to set expiry headers by default), unless you are temporarily disabling other rules.
Moving the default rule to the bottom looks like this, but is still incorrect:
Since the less specific rule is first, the second rule will never be evaluated - all jpeg requests will get an expiration time of 1 day, which isn't what we want.
Here's the correct ordering, showing the more specific rule first:
This will be processed correctly as follows:
- If the request was for a jpeg file in /images, the expiration time will be 4 hours
- If the request was for any other file type in /images, the expiration time will be 1 day
- for files outside of /images, the expiration time will be 1 week
Should you have any questions or need help with the Expire Headers, contact your Account Manager or Support at any time and we'll be happy to help.
0 Comments