Re: Problems with caching and headers.

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

 



Jochem Maas wrote:
Mathijs wrote:

...

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.


freaking lightbulb moment for me!!! see how it pays to help people - you never know
when you might get slapped in the face with some new knowledge :-) thanks!

that said I wonder whether generating the dynamic content, buffering it, using the buffer to
generate a md5 hash and then checking that is any faster than just outputting the
generating content regardless? or is this purely a tactic to reduce bandwidth?

LoL. And no problem.

Um yea it's an bandwidth saving tactic.
This because the website has big traffic.
And it is mostly the JS and CSS files that are eating everything up.
If i compress them it saves a lot of bandwidth.

I Just discovered this problem with IE and the ETag :(.
I use Opera and Firefox my self. But didn't really checked this caching in IE.
And most of the users still use IE.

I Think i have to weigh the features.
The content isn't going to be changed that much.
Only when someone changes the language or if i change some constant values.

So i think i go for this solution since there is non so ever to fix this for IE.

I am going to check the user-agent.
If it is IE then i am not going to gzip the contents.
Everything else then IE will get the gziped contents.

This way the ETag gets send back, and i can respond with an 304 if it still is the same.
This should save bandwidth also. And it will only send out an un-compressed version just once.
And it will resend the content when it is changed (Which i think won't happen that much).

Again, thanks for you thoughts :).
(Hartelijk dank voor de hulp :D ).

Mathijs

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