java - cache control on subdomain in Tomcat 7 -
i can handle cache on core domain (www.domain.com) using below filter
public class cachecontrol implements filter{ filterconfig filterconfig; public cachecontrol() { filterconfig = null; } @override public void init(filterconfig filterconfig) throws servletexception { this.filterconfig = filterconfig; } @override public void dofilter(servletrequest request, servletresponse response, filterchain chain) throws ioexception, servletexception { string scache = filterconfig.getinitparameter("cache"); if (scache != null) { date _currentdate = new date(); ((httpservletresponse) response).setheader("cache-control", scache); ((httpservletresponse) response).setheader("expires", new date(_currentdate.getyear(), _currentdate.getmonth(), _currentdate.getdate() + 10).tostring()); ((httpservletresponse) response).setheader("x-content-type-options", "nosniff"); ((httpservletresponse) response).setheader("x-xss-protection", "1; mode=block"); ((httpservletresponse) response).setheader("x-frame-options", "sameorigin"); ((httpservletresponse) response).setheader("x-ua-compatible", "ie=edge, chrome=1"); } chain.dofilter(request, response); } @override public void destroy() { filterconfig = null; } }
but put static content javascripts, css, images on (static.domain.com) , want set expiry header content coming static domain. googled there no perfect solution. please me set expiry header static domain....
Comments
Post a Comment