HTTP Zones (previously Cache rules) use a simple wildcard format. The format wildcard format used in popular operating systems in respect to the * character. The | character can be used to supply multiple options for a rule. See the examples below for more information.

Examples

Rule Description Matches
/abc/* Matches a static file directory or path component "/abc", "/abc/1.html", "/abc.html"
*.css Matches an extension of css "/a/main.css", "/main.css"
/style/*.css Matches an extension of css within the directory of style "/style/main.css", "/style/2/main.css"
/abc.html Matches /abc.html exactly only "/abc.html"
.css|.js Matches an extension of css or js "/a/main.css", "/jquery.js"
type:images Matches images. Valid types include: images, resources, documents and sound "image.png", "image.jpg"

Pre-defined Types

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

Have we missed your favourite filetype? You can define custom rules using the wildcard format. You can also contact us via support ticket to extend these lists.

Cache conditions

There two conditions that determine if a request is cached. First if the file is over 10mb, it will not be cached. Secondly the headers are checked to ensure the content requested is cache-able. The cache is not for storing large files, each service is limited at 100mb.

Headers

The cache honors backend's "Expires", "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 uncacheable:

  • Set-Cookie

  • Cache-Control containing "no-cache", "no-store", "private", or a "max-age" with a non-numeric or 0 value

  • Expires with a time in the past

  • X-Accel-Expires: 0

Redirection

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

  • $url - The 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: https://$host$uri

Notes

  • HTTP Zones can contain spaces

  • HTTP Zones cant match double forward slashes, this is in turn with how most browsers send requests anyway.

  • Caching does not impact bandwidth costs, cached requests are billed as if they are fetched from your server. This is subject to change when we get around to implementing it.