You are not logged in Log in Join
You are here: Home » Members » itamar » CachingZWiki » HTTPHeaders » wikipage_view

Log in
Name

Password

 
 
FrontPage »

HTTPHeaders

HTTP caching headers are used by browsers and proxies to decide whether they should cache an page (or image) or not. In Zope, only images and files generate caching headers by default, but by adding them to your own pages you can significantly speed up browsing speed.

Even better, if most of your site is cacheable - that is, even if it is dynamically generated, the output is always or mostly the same - then you can put Squid or Apache in front of Zope. The result is that all pages that have the appropriate HTTP headers will be served off the proxy's cache, which means they will be as fast as static pages.

This can speed up your site's potential hits-per-second by a factor of 10! It's also easy to do, and doesn't involve any major changes to Zope or to your site. Even if you don't use a proxy you should still generate these headers, since it will allow browsers to cache your content.

So how do you generate these headers in Zope? (Someone fix the formatting please!!)

DTML to modify HTTP Header

<dtml-call "RESPONSE.setHeader(Expires, Wed, 26 Feb 2002 08:21:57 GMT)">

<dtml-call "RESPONSE.setHeader(Cache-Control, public)">

For more information about HTTP caching headers check out the Cacheability Engine - the software is in Python, and the tutorial is very informative.

If you want to use a caching proxy you can use either Apache or Squid:

Fixed the formatting, it has to do with having multiple lines, I think ZWiki assumes it's a heading. -Otto