[Mod_gzip] mod_gzip, cache-control and php

mod_gzip@lists.over.net mod_gzip@lists.over.net
Fri, 7 Nov 2003 19:09:32 +0200


Hi John,


> I recently upgraded apche and now have installed mod_gzip.

which version of Apache and mod_gzip do you refer to?

> 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=NOI NID CURa OUR NOR UNI");

How did you come to this conclusion?

Did you inspect the HTTP headers of the outgoing data using any tool like
     http://www.schroepl.net/cgi-bin/http_trace.pl
?

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

Hm... I am not familiar with the way Apache automatically adds HTTP headers
in your case of using a PHP module, but mod_gzip isn't supposed to remove
any HTTP headers, while it in fact adds some of its own (like "Vary:" and
"Content-Encoding") and might change some (like "Content-Length").

So all I can tell you is this:

a) I am surprised that mod_gzip should make any difference in your
scenario,
   because I am doing a very similar thing from a Perl CGI script (I need
to
   send caching headers that relate to a certain time on the next day when
   some housekeeping process will run, thus I have to compute its content
on
   the fly), and this works perfectly in combination with mod_gzip.

b) I am setting HTTP headers similar to you, but using Apache's
mod_headers,
   and in combination with mod_gzip 1.3.26.1a (and Apache 1.3.26), and this
   works as expected - which might possibly be different from you scenario
   as mod_headers might probably be active even after mod_gzip has handled
   the content (which I am not sure about, as I don't know how to trace the
   state of the HTTP headers during mod_gzip operation).
If your HTTP header setting is based on static information (like an URL for
your PHP script, and not based on some runtime computations like in my
case),
then you might use my method as a workaround if we cannot find a solution
of
the problem itself.
But actually, I suspect your problem to be different from your description
and would like to see the http_trace output of some page from your server.


Regards, Michael