Re: Problems with caching and headers.
| From: | Jochem Maas | Date: | Tue, 11 Jul 2006 11:58:10 +0000 |
| Subject: | Re: Problems with caching and headers. | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239305@lists.php.net to get a copy of this message | ||
Mathijs wrote:
> Mathijs wrote:
>> Jochem Maas wrote:
>>> Mathijs wrote:
>>>> Hello there,
>>>>
>>>> I can't figure out why there are some headers set while i don't set
>>>> them
>>>> myself.
>>>>
>>>> The following headers are sent to the browser.
>>>> -Expires: Thu, 19 Nov 1981 08:52:00 GMT
>>>> -Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
>>>> pre-check=0
>>>> -Pragma: no-cache
>>>>
>>>> All those i didn't set my self.
>>>>
>>>> Does PHP set these or something?
>>>
>>> maybe it was php (check your session settings and read the relevant
>>> parts of the manual
>>> regarding session related headers)
>>>
>>> maybe it was a piece of 3rd party code.
>>>
>>> may it was 'something' ;-)
>>>
>>> most likely it's the session extension doing this.
>>>
>>
>> And you are right again :).
>> Thanks again.
>>
>> This was a real pain in the ass.
>> Because IE didn't sent the If-Last-Modified and/or if-none-match if
>> one of those headers are sent.
>>
>> Thank you.
>>
>>
>>>> Thx in advanced.
>>>>
>>
>
> Well it seems its working kinda.
>
> Now i have a problem with the ETag.
what are you using this header for?
> Internet Explorer seems to forget this when the content is compressed.
> This because of the Vary header apparently.
>
> Is there a fix for this?
> Or a workaround?
yes. but your no longer in the realm of php (I believe)
this is something you should tackle at the webserver configuration level...
on one of the machines I run the (main) site has this in the config (its apache):
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \/image\.php no-gzip dont-vary
# Also don't compress PDF and Flash-files 17-01-2004 MM
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.swf$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
now I'm not saying these settings will work for you - the site in question
runs behind an instance of Squid configured as a reverse caching proxy - which
complicates matters somewhat - but it might give you an idea.
>
> Thx.
>
>
>
> ---
> avast! Antivirus: Outbound message clean.
> Virus Database (VPS): 0628-1, 07-10-2006
> Tested on: 07-11-2006 13:33:12
> avast! - copyright (c) 1988-2006 ALWIL Software.
> http://www.avast.com
>
>
>