House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

<cfheader> and caching

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
jmauney
06/23/2003 04:57 PM

I'm trying to keep my pages from caching in visitors browsers and/or proxy servers. I found the following code online that uses cfheader: <CFHEADER NAME="Expires" VALUE="Mon, 06 Jan 1990 00:00:01 GMT"> <CFHEADER NAME="Pragma" VALUE="no-cache"> <CFHEADER NAME="cache-control" VALUE="no-cache"> Do I have to put that code in the <head></head> section of my pages, or can it just go at the top? Can I put it in my Application.cfm file? Should I bother with META tags too? Has anyone had any experiences with this that could be helpful? Thanks, Jonathan ________________________________________________________ Jonathan Mauney Manager, Digital Media Properties / Web Application Developer 1110 WBT AM / 107.9 the LINK (WLNK-FM) / Jefferson-Pilot Radio Network Jefferson-Pilot Communications Co. One Julian Price Place Charlotte, North Carolina 28208

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
jeremy
06/23/2003 05:04 PM

I found this somewhere and put it in my cfapplication and it seems to work. The cfapplication would be the way to go I would think. <CFSET gmt = gettimezoneinfo()> <CFSET gmt = gmt.utcHourOffset> <CFIF gmt EQ 0>    <CFSET gmt = ""> <CFELSEIF gmt GT 0>    <CFSET gmt = "+" & gmt > </CFIF> <CFHEADER NAME="Pragma" VALUE="no-cache"> <CFHEADER NAME="Cache-Control" VALUE="no-cache, must- revalidate"> <CFHEADER NAME="Last-Modified" VALUE="#DateFormat(now (), 'ddd, dd mmm yyyy')# #TimeFormat(now(), 'HH:mm:ss')# GMT#gmt#"> <CFHEADER NAME="Expires" VALUE="Mon, 26 Jul 1997 05:00:00 GMT"> JLB I'm trying to keep my pages from caching in visitors browsers and/or proxy servers. I found the following code online that uses cfheader: <CFHEADER NAME="Expires" VALUE="Mon, 06 Jan 1990 00:00:01 GMT"> <CFHEADER NAME="Pragma" VALUE="no-cache"> <CFHEADER NAME="cache-control" VALUE="no-cache"> Do I have to put that code in the <head></head> section of my pages, or can it just go at the top? Can I put it in my Application.cfm file? Should I bother with META tags too? Has anyone had any experiences with this that could be helpful? Thanks, Jonathan ________________________________________________________ Jonathan Mauney Manager, Digital Media Properties / Web Application Developer 1110 WBT AM / 107.9 the LINK (WLNK-FM) / Jefferson-Pilot Radio Network Jefferson-Pilot Communications Co. One Julian Price Place Charlotte, North Carolina 28208

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Paul Hastings
06/23/2003 09:57 PM

> <CFSET gmt = gmt.utcHourOffset> ----- Excess quoted text cut - see Original Post for more ----- not all timezones are hour offsets from GMT, you should also add utcMinuteOffset to your GMT.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ben Doom
06/23/2003 05:08 PM

I included them in the application.cfm of a site (maybe not a best practice, but it was a post hoc fix) and it worked fine.  I'll let others speak to the wisdom of that, though. Anyway, unless I've missunderstood, these send a HTTP response header, so they go out before the <head> block.  IIRC, you have to put them within the first 4000 chars, but otherwise it doesn't really matter. In any case, I skipped the meta tags.  No one has complained yet. --  Ben Doom     Programmer & General Lackey     Moonbow Software, Inc : -----Original Message----- : From: jmauney@jpc.com [mailto:jmauney@jpc.com] : Sent: Monday, June 23, 2003 4:54 PM : To: CF-Talk : Subject: <cfheader> and caching : : : I'm trying to keep my pages from caching in visitors browsers and/or proxy : servers. I found the following code online that uses cfheader: : : <CFHEADER NAME="Expires" VALUE="Mon, 06 Jan 1990 00:00:01 GMT"> : <CFHEADER NAME="Pragma" VALUE="no-cache"> : <CFHEADER NAME="cache-control" VALUE="no-cache"> : : Do I have to put that code in the <head></head> section of my : pages, or can : it just go at the top? Can I put it in my Application.cfm file? Should I : bother with META tags too? Has anyone had any experiences with this that : could be helpful? : : Thanks, : Jonathan : ________________________________________________________ : Jonathan Mauney : Manager, Digital Media Properties / Web Application Developer : 1110 WBT AM / 107.9 the LINK (WLNK-FM) / Jefferson-Pilot Radio Network : Jefferson-Pilot Communications Co. : One Julian Price Place : Charlotte, North Carolina 28208 : : :

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matthew Walker
06/23/2003 05:37 PM

Yes, these seem to work very reliably. Unlike cfhtmlhead, they don't translate into HTML tags but rather appear in the header block with the cookies and other whatnot, so you don't need to put them in your head. You do need to put them near the top of your doc, so Application.cfm would work out fine. Matthew Walker Electric Sheep Web http://www.electricsheep.co.nz/ ----- Excess quoted text cut - see Original Post for more ----- can ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

September 17, 2014

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30         

Designer, Developer and mobile workflow conference