Sep 182009
Do you use Jetty and need to change the default setting for browser cache control? Have a look at the init-param element named cacheControl in webdefault.xml.
Here’s the default configuration for the version of Jetty I use. Note the element is commented.
<!-- <init-param> <param-name>cacheControl</param-name> <param-value>max-age=3600,public</param-value> </init-param> --> |
To enable and configure browser cache control, uncomment and edit the param-value as appropriate. The following example instructs the browser to disable all caching.
<init-param> <param-name>cacheControl</param-name> <param-value>no-store,no-cache,must-revalidate</param-value> </init-param> |
For information on Cache-Control, see RFC 2616, Section 14.9.
Thanks for this!
But for some reason Jetty seems to ignore this. I have yet to see a response with the Cache-Control header set. The settings seems to get ignored.
Hi Jochen, I just double checked and it’s working for me:
HTTP/1.1 200 OK
Date: Tue, 13 Apr 2010 17:11:31 GMT
Accept-Ranges: bytes
Cache-Control: no-store,no-cache,must-revalidate
Content-Type: text/html
Content-Length: 4339
Last-Modified: Mon, 12 Apr 2010 21:43:54 GMT