Forum OpenACS Q&A: Response to MS Proxy Server and Caching Problem with OpenACS 4.2 Web Site

Hi there!

Yes, setting the cache control headers in the master template as follows solved all our problems.  I would highly recommend this as the default for almost all dynamically generated pages, since, as explained above, it forces "bad" proxies to behave properly:

ns_set put [ns_conn outputheaders] "Cache-Control" "private"

ns_set put [ns_conn outputheaders] "Expires" "Thu, 01 Jan 1998 07:00:00 GMT" (or some date in the past)

(You could also send a "Pragma: no-cache", though we did not find it to be necessary or sufficient.)

However, as Don and Russell mentioned, there is no easy way of determining whether a dynamic page has changed.  If performance is a serious issue, there are some techniques described in the article above.

For example, if you know the page won't change very often, and you roughly know the frequency of change, and if sending slightly stale data to your users is not a huge concern, then you could set an "Expires" header for some reasonable date/time in the future.

Or, you could set a "Last Modified" header and, as appropriate, respond to "If Modified Since" requests from the client or proxy with a 304 (Not Modified) or 200 (send the new version of the page).  I imagine that would be pretty difficult, though Russell had some interesting ideas for implementing it.

Hope this helps...