HTTP Zones (also known as Cache Rules) use a simple wildcard format to altered behavior and caching of specific locations and file extensions. The wildcard character of
| character can be used to supply multiple options for a rule. See the examples below for more information.
| ||Matches a static file directory or path component||"/abc", "/abc/1.html", "/abc.html"|
| ||Matches an extension of css||"/a/main.css", "/main.css"|
| ||Matches an extension of css within the directory of style||"/style/main.css", "/style/2/main.css"|
| ||Matches /abc.html exactly||only "/abc.html"|
| ||Matches an extension of css or js||"/a/main.css", "/jquery.js"|
| ||Matches images. Valid types include: images, resources, documents and sound||"image.png", "image.jpg"|
We supply a set of pre-existing cache categories that can be applied over many filetypes (using the
type:<typename> syntax). These are as follows:
- images: Matches .jpg, .jpeg, .gif, .ico, .png, .bmp, .pict, .tif, .tiff, .svg, .svgz
- sound: Matches .midi, .mid, .pls, .mp3, .wav
- documents: Matches .csv, .doc, .pdf, .ppt, .eps, .docx, .xlsx, .xls, .pptx, .ps
- resources: Matches .css, .js, .swf, .ttf, .eot, .woff, .ejs, .class, .jar, .otf, .webp
Caching for images is enabled by default.
Have we missed your favorite filetype? You can define custom rules using the wildcard format.
There three conditions that determine if a request is to be stored into the cache.
- If the file is over 10mb, it will not be cached.
- The headers are checked to ensure the content requested is cacheable
- There is no content adjusting mitigation event ocurring on this request
The cache is not for storing large files, each service is limited at 100mb. Data is expired on a Least Recently Used basis in addition to the Expiration time.
The following cache policies are available: - Cache: Caching is enabled by this rule (default for cache rules) - Disabled: Caching is disabled by this rule (default for ports) - Force: Caching is enabled for nearly all requests (regardless of headers) - Fallback: Serving from cache is only enabled when the backend is offline
In Cache mode Cache-Controla and Expires headers are honored. Specifically:
Cache-Control: private skips storage into the cache
Cache-Control: no-store skips storage into the cache
Cache-Control: no-cache skips storage into the cache
Cache-Control: max-age=0 skips storage into the cache
Expires: <past-date> skips storage into the cache
The cache honors backend's
Cache-Control: no-cache, and
Cache-Control: max-age=XXX headers. We do not handle "Vary" headers when caching. In order to ensure private items are not served to all users unintentionally by the cache, the back-end can set "no-cache" or "max-age=0".
The following response headers flag a response as uncachable:
private, or a
max-agewith a non-numeric or 0 value
Expires with a time in the past
It optionally possible to define a redirect for a matching HTTP Zone. In this situation any caching settings will not take effect.
Redirection URLs mat contain the following variables:
$scheme- The requested scheme (e.g "http" or "https")
$host- The requested domain name
$uri- The path of the current request, including the leading slash
$request_uri- Urlencoded path and query string component of a request, including the leading slash
For example, it is possible to redirect all requests to the https version of your site with a rule such as the following:
HTTP Zones paths can contain spaces
Double slashes in paths will be combined into a single slash. HTTP Zones cant match double forward slashes in url (like most browsers).