[Techtalk] caching and apache2

Almut Behrens almut-behrens at gmx.net
Wed Jul 12 21:51:05 UTC 2006


On Wed, Jul 12, 2006 at 06:59:53PM +0100, Caroline Johnston wrote:
> 
> I've managed to get this working now, but I'm hitting problems
> with pages in iframes. Basically, I have some svg files that are changed
> often. They can be <embed>ed or <iframe>d in an html page. When I access
> the svg files directly, they don't cache, but when I access the parent
> page, unless the url changes it doesn't reload the svg file. I've managed
> to work around it because the parent file is actually dynamically
> generated, so I can add a ?param=somerandomvalue to the end of the iframe
> src url, but it seems a bit clunky. Am open to suggestions for a nicer way
> of doing this?

ahh, browser caching... This has already driven a number of people
close to insanity ;)  Considering the big mess this whole caching issue
is (getting better, though), your "workaround" seems like a rather
elegant solution.  At least, it should work on any browser which is not
entirely broken...

In case you still want to play around with alternative approaches, just
a few random pointers here.  My apologies, if this sounds RTFM-like --
I promise, it's not meant that way. It's just that I'm a bit in a hurry
at the moment...

For one, it's good to know what the theory says; e.g., for HTTP/1.1:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 .
There are a number of similar caching directives for slightly different
purposes. But maybe, you've perused this stuff already.
Then, there's also the related Expires, ETag, etc. headers...

Generally, many of those are HTTP/1.1 only, so make sure that's
actually what the browser/webserver is talking.  BTW, is this a direct
browser-to-webserver connection, or are there any proxies in between?

Although the w3 document makes frequent use of the word "MUST",
real-world implementations sometimes interpret those things as if
they were more of an advisory nature...  So, trial and error often is
the only sensible approach here.

There's a neat page to test client caching features and behaviour:
http://www.mnot.net/javascript/xmlhttprequest/cache.html
For some additional ideas also see the related blog entry
http://www.mnot.net/blog/2006/05/11/browser_caching

And, if it comforts you to see that other people are having similar
problems, just google for "iframe caching" :) -- you might even come
across one or the other interesting suggestion...

Good luck,
Almut


More information about the Techtalk mailing list