I added wro4j to my Spring MVC project a couple of weeks ago and I am very happy with it so far. The only problem I have is that aggressive caching leads to JS and CSS files not reloaded by the browser when they are updates.
I researched the web about caching and found this document by google:
which seems to give some good tips. One statement caught my attention:
It is important to specify one of Expires
or Cache-Control max-age
, and one of Last-Modified
or ETag
, for all cacheable resources. It is redundant to specify both Expires
and Cache-Control: max-age
, or to specify both Last-Modified
and ETag
.
The response headers generated for wro4j for my JS resources look like:
Cache-Control | public, max-age=315360000 |
Content-Encoding | gzip |
Content-Length | 20746 |
Content-Type | text/javascript;charset=UTF-8 |
Date | Tue, 30 Jul 2013 08:07:47 GMT |
Etag | "2135a7433afba4445c1e4c61372a8206cbc5b35a" |
Expires | Wed, 30 Jul 2014 07:59:04 GMT |
Last-Modified | Tue, 30 Jul 2013 07:59:04 GMT |
Server | Apache-Coyote/1.1 |
Vary | Accept-Encoding |
Clearly the headers are redundant - was this implemented intentionally or should this be changed?