Details
-
Bug
-
Status: In Progress
-
Normal
-
Resolution: Unresolved
-
None
-
None
-
None
-
Flagged
-
Orion
-
Orion.Cycle.Sprint.Candidate
Description
#setExpiresHeaders method inĀ org.hippoecm.hst.servlet.utils.HeaderUtils.setExpiresHeaders(HttpServletResponse response, BinaryPage page) calculates the max-age for binaries value based on the last modified date. It seems that newly uploaded images will get a low value, while older images will get very high numbers over a few years.
Also can we make max-age configurable?
public static void setExpiresHeaders(HttpServletResponse response, BinaryPage page) { final long lastModifiedDate = page.getLastModified(); if (lastModifiedDate > 0) { final long expires = System.currentTimeMillis() - lastModifiedDate; if (expires > 0) { response.setDateHeader(HTTP_EXPIRES_HEADER, expires + System.currentTimeMillis()); HstRequestContext requestContext = RequestContextProvider.get(); boolean isPreview = requestContext != null && requestContext.isPreview(); response.setHeader(HTTP_CACHE_CONTROL_HEADER, (isPreview ? CACHE_CONTROL_PRIVATE : CACHE_CONTROL_PUBLIC) + ", max-age=" + (expires / MILLIS_IN_SEC)); } } }
So why the expires = System.currentTimeMillis() - lastModifiedDate?