Re: Problems with caching and headers.
| From: | Mathijs | Date: | Tue, 11 Jul 2006 12:46:46 +0000 |
| Subject: | Re: Problems with caching and headers. | ||
| References: | 1 2 3 4 5 | Groups: | php.general php.general |
| Request: | Send a blank email to php-general+get-239308@lists.php.net to get a copy of this message | ||
Jochem Maas wrote:
Mathijs wrote:I Use this header to check if the content of a file has changed. This because the content can be variable. But is static most of the time. I Compute an MD5 of the content, and add this to the ETag. Normally a browser sends an HTTP_IF_NONE_MATCH back if it has an ETag. If this gets send back, i compare them and if they are the same, they get en 304 Not Modified back. Now Internet Explorer doesn't send this back when the content has been compressed (gz_handler). This because the Vary header has been set or something. This is a bug in IE, and probably fixed in IE7.Mathijs wrote:what are you using this header for?Jochem Maas wrote:Well it seems its working kinda. Now i have a problem with the ETag.Mathijs wrote: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.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.Thx in advanced.
I have checked this also, and it came up with nothing. :(. It now seems that i have to check if i am dealing with Internet Explorer or not within PHP. And then if it is IE i don't compress the content. Anyway, Thank you very much for your help :). If you have any idea's left :D. Kind Regards, Mathijs.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 fineBrowserMatch \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 imagesSetEnvIfNoCase 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 MMSetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary SetEnvIfNoCase Request_URI \.swf$ no-gzip dont-vary# Make sure proxies don't deliver the wrong contentHeader append Vary User-Agent env=!dont-varynow 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.
--- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0628-1, 07-10-2006 Tested on: 07-11-2006 14:47:23 avast! - copyright (c) 1988-2006 ALWIL Software. http://www.avast.comThx. --- 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