Re: Problems with caching and headers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jochem Maas wrote:
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?

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.



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.

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.


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




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux