Keeping Content From Caching

The tags below are what I use to keep dynamic data from being cached:

<cfheader name=”Cache-Control” value=”no-store” />
<cfheader name=”Pragma” value=”no-cache” />
<cfheader name=”Expires” value=”Tue, 16 Oct 1973 00:00:00 GMT” />

(The value of the “Expires” header is not some magical date — it can be any date in the past. I usually use my birthday, just for fun.)

These headers address client-side caching (caching by the browser), and server-side caching (proxy servers that do caching, like those used by AOL). The “Pragma” tag is a little obsolete and has been replaced by the “Cache-Control” tag in HTTP 1.1, but I keep it in there just to be safe. These tags go at the top of my Application.cfm file, just below the CFAPPLICATION tag. So far, I have had pretty good luck with them, and they go in just about every application I write.

For more information on how AOL handles proxy server caching (something all web developers need to be aware of), check out this document published by AOL.