Reputation: 1
i am using below cache control lines in jsp
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
response.setDateHeader("Expires", 0);
but still my javascript files are getting cached to the disk. does this prevents caching of only JSP or also JS files? is there any other way to avoid caching of javascript files to disk? Please help me out of this Thanks you
Upvotes: 0
Views: 1048
Reputation: 717
It only disables cache for your JSP page, because javascript/images are loaded with separate HTTP requests (that will not have those headers you're setting). You need to look into you web server's config. Another option is adding a ?version=X
to your javascripts' URL (X being timestamp if you want to prevent all caching or source control revision number if just want users to get latest production files).
Upvotes: 2