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 * and | 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 favorite 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.

  1. If the file is over 10mb, it will not be cached.
  2. The headers are checked to ensure the content requested is cacheable

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.

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 uncachable:

  • 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

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

Additional Notes

  • 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).