[Mod_gzip] Mod_gzip and Cache-Control No Cache

John Stephens mod_gzip@lists.over.net
Thu, 13 Nov 2003 17:36:12 +0700


This is a multi-part message in MIME format.

------=_NextPart_000_0041_01C3AA0C.A1B18100
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Kevin,

Regarding my problem about the caching, I was misinformed by my team. =
They were trying to resolve the temp file issue not caching. Caching I =
think was working fine. We used the following headers and it resolved =
our cache problem.  However for the temp file issue we tried everything =
from recompiling apache, upgrading, but no cigar. I thinks Kevin your =
aswer is right on the mark and explain a lot of things. I will to do =
somemore testing and if I find anything I will let you guys know.=20

Thanks for all your help.

John




  ----- Original Message -----=20
  From: TOKILEY@aol.com=20
  To: mod_gzip@lists.over.net=20
  Cc: john@impaqads.com ; TOKILEY@aol.com=20
  Sent: Thursday, November 13, 2003 3:31 PM
  Subject: Re: [Mod_gzip] Mod_gzip and Cache-Control No Cache



  Hi John...
  Kevin again...

  > Thanks for the help. I got past the caching already.

  That's great... but would you mind letting us all know
  what 'got you past it'? When people resolve issues they
  have posted around here we like there to be an
  explanation for the sake of maybe other people running
  into the same thing in the future.

  What did you do to 'get past the caching' (problem)?

  > I do have another problem.=20

  I hear ya. If it ain't one thing it's another. ROFL

  > My PHP page are being store in the Temporary Internet Files=20
  > folder. Although I am using PHP, when I look in the temp I see=20
  > the files but its in html format. I saw a couple of posts on this=20
  > but no reply. =20
  >=20
  > Basically i dont want m php pages being store in the users temp=20
  > internet files folder.  With modzip off, it works like a charm, wih =
it=20
  > on, it stores it as html. Really strange.=20

  I think I have an explanation for you but I don't think you
  are going to like it.

  What most people don't realize is that all modern browsers=20
  that support 'decompression' are actually using their own
  local caches to get the job done. As the data arrives it is
  'written' into a cache file locally and then they launch a=20
  thread which calls ZLIB ( or the equivalent ) to start=20
  decompressing the data being received. Even if the Server
  is 'streaming' the compressed data it's still being written
  into a 'workfile' on the disk and then the REAL ( decompressed )
  HTML page is being 'assembled' in another cache file as
  ZLIB works on the workfile.

  What I think you are seeing is just another bug in MSIE.
  I believe you are seeing a situation where MSIE has
  ended up ignoring all cache-control directives and you=20
  are simply seeing the .html 'workfile' that MSIE came
  up with while it was decompressing the original URI.

  Netscape is no better... and actually it's worse.

  Netscape ends up keeping BOTH files around in its
  'Temporary Internet Files' cache. It even goes brain
  dead sometimes and tries to use the original compressed
  cache file like when you tell Netscape to 'print' any
  page that arrived with compression. It 'forgets' that it
  did any decompression when it's on that control path
  and it stupidly tries to print the compressed file from
  it's own cache because it's still 'hanging around'.

  MSIE will always delete the original compressed=20
  workfile in 'Temporary Internet Folders' but ( as you
  are seeing ) the resulting 'decompressed' page=20
  hangs around regardless of cache directives.

  The reason it all works when there is no compression
  is because nothing has short-circuited the cache=20
  control because this whole 'use a work file' thing
  never kicked in.

  My only advice is the same as before.

  Try using "Expires: -1" in the response header.

  If MSIE still keeps a 'copy' of the response in its
  own local cache when it shows up with "Expires: -1"
  then it is truly, truly broken.

  Later...
  Kevin





  In a message dated 11/13/2003 12:02:54 AM Central Standard Time, =
john@impaqads.com writes:



    Hi Kevin

    Thanks for the help. I got past the caching already but I do have =
another problem. My PHP page are being store in the Temporary Internet =
Files folder. Although I am using PHP, when I look in the temp I see the =
files but its in html format. I saw a couple of posts on this but no =
reply. =20

    Basically i dont want m php pages being store in the users temp =
internet files folder.  With modzip off, it works like a charm, wih it =
on, it stores it as html. Really strange.=20

    Any suggestions would be extremely appreciated.=20

    Thanks=20

    John


      ----- Original Message -----=20
      From: TOKILEY@aol.com=20
      To: mod_gzip@lists.over.net=20
      Cc: john@impaqads.com ; TOKILEY@aol.com=20
      Sent: Thursday, November 13, 2003 12:32 PM
      Subject: Re: [Mod_gzip] Mod_gzip and Cache-Control No Cache



      Hi John...
      This is Kevin Kiley...

      Why not just add "Expires: -1" to the response header
      for anything you don't want cached? ( PHP scripts only? ).

      AFAIK there is no proxy cache on the planet that will
      ever cache anything if it has "Expires: -1" on the
      response. All the 'other' cache control directives
      ( especially the pragma stuff ) is 'iffy'. Sometimes
      it functions as advertised, sometimes not. Depends
      on the software.

      If I recall... MSIE is famous for ignoring 'pragma: no-cache'
      but "Expires: -1" works even with MSIE.

      Later...
      Kevin

      In a message dated 11/12/2003 5:54:31 PM Central Standard Time, =
john@impaqads.com writes:



        Hi Can Anyone please help me.

        I recently upgraded apche and now have installed mod_gzip. =
Mod_gzip is working but for some reason the following headers are no =
longer working.

        Header('Cache-Control: no-cache');
        Header('Pragma: no-cache');
        Header("P3P: CP=3DNOI NID CURa OUR NOR UNI");

        When I turn off mod_gzip i can get them to work and my pages =
dont cache.  What i basically want is to get mod_gzip working and my php =
scripts not to cache. Please help, i've tried everything and no can help =
me.

        Regards

        John=20










------=_NextPart_000_0041_01C3AA0C.A1B18100
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Kevin,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Regarding my problem about the caching, =
I was=20
misinformed by my team. They were trying to resolve the temp file issue =
not=20
caching. Caching I think was working fine. We used the following headers =
and it=20
resolved our cache problem.&nbsp; However for the temp file issue we =
tried=20
everything from recompiling apache, upgrading, but no cigar. I thinks =
Kevin your=20
aswer is right on the mark and explain a lot of things. I will to do =
somemore=20
testing and if I find anything I will let you guys know. =
</FONT></DIV><FONT=20
face=3DArial size=3D2>
<DIV><BR>Thanks for all your help.</DIV>
<DIV>&nbsp;</DIV>
<DIV>John</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3DTOKILEY@aol.com =
href=3D"mailto:TOKILEY@aol.com">TOKILEY@aol.com</A>=20
  </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3Dmod_gzip@lists.over.net=20
  href=3D"mailto:mod_gzip@lists.over.net">mod_gzip@lists.over.net</A> =
</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Cc:</B> <A =
title=3Djohn@impaqads.com=20
  href=3D"mailto:john@impaqads.com">john@impaqads.com</A> ; <A=20
  title=3DTOKILEY@aol.com =
href=3D"mailto:TOKILEY@aol.com">TOKILEY@aol.com</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Thursday, November 13, =
2003 3:31=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [Mod_gzip] =
Mod_gzip and=20
  Cache-Control No Cache</DIV>
  <DIV><BR></DIV><FONT face=3Darial,helvetica><FONT size=3D2><BR>Hi =
John...<BR>Kevin=20
  again...<BR><BR>&gt; Thanks for the help. I got past the caching=20
  already.<BR><BR>That's great... but would you mind letting us all =
know<BR>what=20
  'got you past it'? When people resolve issues they<BR>have posted =
around here=20
  we like there to be an<BR>explanation for the sake of maybe other =
people=20
  running<BR>into the same thing in the future.<BR><BR>What did you do =
to 'get=20
  past the caching' (problem)?<BR><BR>&gt; I do have another problem. =
<BR><BR>I=20
  hear ya. If it ain't one thing it's another. ROFL<BR><BR>&gt; My PHP =
page are=20
  being store in the Temporary Internet Files <BR>&gt; folder. Although =
I am=20
  using PHP, when I look in the temp I see <BR>&gt; the files but its in =
html=20
  format. I saw a couple of posts on this <BR>&gt; but no reply.&nbsp;=20
  </FONT><FONT lang=3D0 style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial =
color=3D#000000=20
  size=3D3 FAMILY=3D"SANSSERIF"><BR>&gt; <BR></FONT><FONT lang=3D0=20
  style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D2=20
  FAMILY=3D"SANSSERIF">&gt; Basically i dont want m php pages being =
store in the=20
  users temp <BR>&gt; internet files folder.&nbsp; With modzip off, it =
works=20
  like a charm, wih it <BR>&gt; on, it stores it as html. Really =
strange.=20
  <BR><BR>I think I have an explanation for you but I don't think =
you<BR>are=20
  going to like it.<BR><BR>What most people don't realize is that all =
modern=20
  browsers <BR>that support 'decompression' are actually using their=20
  own<BR>local caches to get the job done. As the data arrives it=20
  is<BR>'written' into a cache file locally and then they launch a =
<BR>thread=20
  which calls ZLIB ( or the equivalent ) to start <BR>decompressing the =
data=20
  being received. Even if the Server<BR>is 'streaming' the compressed =
data it's=20
  still being written<BR>into a 'workfile' on the disk and then the REAL =
(=20
  decompressed )<BR>HTML page is being 'assembled' in another cache file =

  as<BR>ZLIB works on the workfile.<BR><BR>What I think you are seeing =
is just=20
  another bug in MSIE.<BR>I believe you are seeing a situation where =
MSIE=20
  has<BR>ended up ignoring all cache-control directives and you <BR>are =
simply=20
  seeing the .html 'workfile' that MSIE came<BR>up with while it was=20
  decompressing the original URI.<BR><BR>Netscape is no better... and =
actually=20
  it's worse.<BR><BR>Netscape ends up keeping BOTH files around in=20
  its<BR>'Temporary Internet Files' cache. It even goes brain<BR>dead =
sometimes=20
  and tries to use the original compressed<BR>cache file like when you =
tell=20
  Netscape to 'print' any<BR>page that arrived with compression. It =
'forgets'=20
  that it<BR>did any decompression when it's on that control path<BR>and =
it=20
  stupidly tries to print the compressed file from<BR>it's own cache =
because=20
  it's still 'hanging around'.<BR><BR>MSIE will always delete the =
original=20
  compressed <BR>workfile in 'Temporary Internet Folders' but ( as =
you<BR>are=20
  seeing ) the resulting 'decompressed' page <BR>hangs around regardless =
of=20
  cache directives.<BR><BR>The reason it all works when there is no=20
  compression<BR>is because nothing has short-circuited the cache =
<BR>control=20
  because this whole 'use a work file' thing<BR>never kicked =
in.<BR><BR>My only=20
  advice is the same as before.<BR><BR>Try using "Expires: -1" in the =
response=20
  header.<BR><BR>If MSIE still keeps a 'copy' of the response in =
its<BR>own=20
  local cache when it shows up with "Expires: -1"<BR>then it is truly, =
truly=20
  broken.<BR><BR>Later...<BR>Kevin<BR><BR><BR><BR><BR><BR>In a message =
dated=20
  11/13/2003 12:02:54 AM Central Standard Time, john@impaqads.com=20
  writes:<BR><BR><BR>
  <BLOCKQUOTE=20
  style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid; MARGIN-RIGHT: 0px"=20
  TYPE=3D"CITE">Hi Kevin</FONT><FONT lang=3D0 style=3D"BACKGROUND-COLOR: =
#ffffff"=20
    face=3DArial color=3D#000000 size=3D3 =
FAMILY=3D"SANSSERIF"><BR><BR></FONT><FONT=20
    lang=3D0 style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial =
color=3D#000000 size=3D2=20
    FAMILY=3D"SANSSERIF">Thanks for the help. I got past the caching =
already but I=20
    do have another problem. My PHP page are being store in the =
Temporary=20
    Internet Files folder. Although I am using PHP, when I look in the =
temp I=20
    see the files but its in html format. I saw a couple of posts on =
this but no=20
    reply.&nbsp; </FONT><FONT lang=3D0 style=3D"BACKGROUND-COLOR: =
#ffffff"=20
    face=3DArial color=3D#000000 size=3D3 =
FAMILY=3D"SANSSERIF"><BR><BR></FONT><FONT=20
    lang=3D0 style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial =
color=3D#000000 size=3D2=20
    FAMILY=3D"SANSSERIF">Basically i dont want m php pages being store =
in the=20
    users temp internet files folder.&nbsp; With modzip off, it works =
like a=20
    charm, wih it on, it stores it as html. Really strange. </FONT><FONT =
lang=3D0=20
    style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D3=20
    FAMILY=3D"SANSSERIF"><BR><BR></FONT><FONT lang=3D0=20
    style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D2=20
    FAMILY=3D"SANSSERIF">Any suggestions would be extremely appreciated. =

    </FONT><FONT lang=3D0 style=3D"BACKGROUND-COLOR: #ffffff" =
face=3DArial=20
    color=3D#000000 size=3D3 FAMILY=3D"SANSSERIF"><BR><BR></FONT><FONT =
lang=3D0=20
    style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D2=20
    FAMILY=3D"SANSSERIF">Thanks </FONT><FONT lang=3D0=20
    style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D3=20
    FAMILY=3D"SANSSERIF"><BR><BR></FONT><FONT lang=3D0=20
    style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D2=20
    FAMILY=3D"SANSSERIF">John</FONT><FONT lang=3D0 =
style=3D"BACKGROUND-COLOR: #ffffff"=20
    face=3DArial color=3D#000000 size=3D3 =
FAMILY=3D"SANSSERIF"><BR></FONT><FONT lang=3D0=20
    style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D2=20
    FAMILY=3D"SANSSERIF"><BR>
    <BLOCKQUOTE=20
    style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff =
2px solid; MARGIN-RIGHT: 0px"=20
    TYPE=3D"CITE">----- Original Message ----- <BR><B>From:</B> <A=20
      href=3D"mailto:TOKILEY@aol.com">TOKILEY@aol.com</A> <BR><B>To:</B> =
<A=20
      =
href=3D"mailto:mod_gzip@lists.over.net">mod_gzip@lists.over.net</A>=20
      <BR><B>Cc:</B> <A =
href=3D"mailto:john@impaqads.com">john@impaqads.com</A> ;=20
      <A href=3D"mailto:TOKILEY@aol.com">TOKILEY@aol.com</A> =
<BR><B>Sent:</B>=20
      Thursday, November 13, 2003 12:32 PM<BR><B>Subject:</B> Re: =
[Mod_gzip]=20
      Mod_gzip and Cache-Control No Cache<BR><BR><BR><BR>Hi =
John...<BR>This is=20
      Kevin Kiley...<BR><BR>Why not just add "Expires: -1" to the =
response=20
      header<BR>for anything you don't want cached? ( PHP scripts only?=20
      ).<BR><BR>AFAIK there is no proxy cache on the planet that =
will<BR>ever=20
      cache anything if it has "Expires: -1" on the<BR>response. All the =
'other'=20
      cache control directives<BR>( especially the pragma stuff ) is =
'iffy'.=20
      Sometimes<BR>it functions as advertised, sometimes not. =
Depends<BR>on the=20
      software.<BR><BR>If I recall... MSIE is famous for ignoring =
'pragma:=20
      no-cache'<BR>but "Expires: -1" works even with=20
      MSIE.<BR><BR>Later...<BR>Kevin<BR><BR>In a message dated =
11/12/2003=20
      5:54:31 PM Central Standard Time, john@impaqads.com =
writes:<BR><BR><BR>
      <BLOCKQUOTE=20
      style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff =
2px solid; MARGIN-RIGHT: 0px"=20
      TYPE=3D"CITE">Hi Can Anyone please help me.</FONT><FONT lang=3D0=20
        style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D3=20
        FAMILY=3D"SANSSERIF"><BR><BR></FONT><FONT lang=3D0=20
        style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D2=20
        FAMILY=3D"SANSSERIF">I recently upgraded apche and now have =
installed=20
        mod_gzip. Mod_gzip is working but for some reason the following =
headers=20
        are no longer working.</FONT><FONT lang=3D0=20
        style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D3=20
        FAMILY=3D"SANSSERIF"><BR><BR></FONT><FONT lang=3D0=20
        style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D2=20
        FAMILY=3D"SANSSERIF">Header('Cache-Control: =
no-cache');<BR>Header('Pragma:=20
        no-cache');<BR>Header("P3P: CP=3DNOI NID CURa OUR NOR =
UNI");</FONT><FONT=20
        lang=3D0 style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial =
color=3D#000000 size=3D3=20
        FAMILY=3D"SANSSERIF"><BR><BR></FONT><FONT lang=3D0=20
        style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D2=20
        FAMILY=3D"SANSSERIF">When I turn off mod_gzip i can get them to =
work and=20
        my pages dont cache.&nbsp; What i basically want is to get =
mod_gzip=20
        working and my php scripts not to cache. Please help, i've tried =

        everything and no can help me.</FONT><FONT lang=3D0=20
        style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D3=20
        FAMILY=3D"SANSSERIF"><BR><BR></FONT><FONT lang=3D0=20
        style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D2=20
        FAMILY=3D"SANSSERIF">Regards</FONT><FONT lang=3D0=20
        style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D3=20
        FAMILY=3D"SANSSERIF"><BR><BR></FONT><FONT lang=3D0=20
        style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D2=20
        FAMILY=3D"SANSSERIF">John </FONT><FONT lang=3D0=20
        style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D3=20
        FAMILY=3D"SANSSERIF"><BR><BR></BLOCKQUOTE><BR></FONT><FONT =
lang=3D0=20
      style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D2=20
      FAMILY=3D"SANSSERIF"><BR></FONT><FONT lang=3D0=20
      style=3D"BACKGROUND-COLOR: #ffffff" face=3DArial color=3D#000000 =
size=3D3=20
      =
FAMILY=3D"SANSSERIF"></BLOCKQUOTE><BR></BLOCKQUOTE><BR><BR></BLOCKQUOTE><=
/FONT></FONT></BODY></HTML>

------=_NextPart_000_0041_01C3AA0C.A1B18100--