The purpose of this page is to describe one strategy for caching of static resources in a JSP based web application.
- External assets should be cached forever.
- Internal images should be cached forever.
- Ensure internal and external assets are put in separate folders.
- Ensure all external assets are versioned
- version in folder OR
- version in filename
- Ensure internal images are versioned if changed.
- Use auto-versioning for internal assets.
- Set Cache-Control headers
- Remove ETags and Last-Modified headers (to increase chance of browsers have the same caching behaviour)
Note the url encoding using c:url.
Good guide to web caching: http://www.mnot.net/cache_docs/