Cache Headers

Proxy Cache Headers

Proxy cache headers for use with reverse proxies and other proxy mechanisms were added in the 6.0.11 milestone release.

To simplify adding cache headers to pages, the upcoming 6.0.11 release adds support for the @@proxyCacheTimeout decorators to webskins. This value specifies the number of seconds that webskin should be cached for. The smallest value specified when constructing a page is added to the header using the max-age and s-maxage headers, or as a set of no-cache headers if 0.

By default, FarCry doesn't add cache headers when no webskin specifies a proxy cache timeout. Use the defaultProxyCacheTimeout constructor setting to change this behaviour. To default to a 2 minute cache:

<cfset this.defaultProxyCacheTimeout = 120 />

If you want FarCry to default to no-cache headers:

<cfset this.defaultProxyCacheTimeout = 0 />

As well as the typical response headers, META tags and an html comment are added to the page. These can help troubleshoot issues with reverse proxies. e.g.:

<META HTTP-EQUIV="Cache-Control" CONTENT="max-age=120,s-maxage=120" />
<!-- Page cached until: Mon, 28 Feb 2011 10:40:58 GMT+11 (120 seconds) -->

Example Cache Header

Cache-Control        max-age=120,s-maxage=120

We use max-age instead of Expires because of time zone complications. Effective use of Expires requires the correct time on the web server, the reverse proxy (or any proxies between the web server and the user), and the user's own computer.

Example No Cache Header

Expires              Tue, 01 Jan 1985 00:00:01 GMT
Pragma               no-cache
cache-control        no-cache, no-store, must-revalidate