-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
6.6.9, 6.8.5, 6.12.2
-
2
-
Severity 2 - Major
-
1
-
Problem Statement
Image caching is crucial for reducing load times to improving overall user experience. However, JPG caching is not functioning well with JPG images on certain browsers i.e. IE, Edge and Firefox. Looking closer into the header attributes, we see that the ETag attribute is not being added to the resource during reload. Hence, the JPG images have to be requested to the server on every page reload.
Expected Behavior
All image files should be cached and retrieved from the cache resource instead of having to requesting from the server directly every page reload.
Actual Behavior
JPG files are requested from the server on every page reload.
- mentioned in
-
Page Failed to load
Hi guys,
we found a work around by fixing the image effects plugin (version 2.0.2). We use a confluence standard method which inserts the "ETag" and "last-modified" into the response header. At least in our browsers (IE11 and Firefox ESR version) the jpgs are cached.
Function<BufferedInputStream, HttpServletResponse> responseSupplier = (imageBufferStream) -> {
response.setContentType(getMimeTypeFrom(imageBufferStream));
//fix https://jira.atlassian.com/browse/CONFSERVER-54780
response.setHeader("X-Content-Type-Options", "nosniff");
if (isPreview) { response._setHeader_("Cache-Control", *_PREVIEW_CACHE_CONTROL_HEADER_*); }
// This method writes the "ETag" and "Last-Modified" in the Response-Header
{ eventPublisher._publish_(*new* *DiskCacheUsageEvent*(*true*, context.*getCacheEntryName*())); *_log_*._debug_("Using the cached value"); *copyToResponse*(cacheStream, responseSupplier); }com.atlassian.plugin.servlet.util.LastModifiedHandler.checkRequest(request, response, new Date(context.getLastModified()));
return response;
};
final InputStream cacheStream = config.isDisableCache() ? null :
imageCache.get(context.getAttachmentId(), context.getCacheEntryName(), context.getLastModified());
if (cacheStream != null)
else {
eventPublisher.publish(new DiskCacheUsageEvent(false, context.getCacheEntryName()));
final boolean responseSent = transformAndRespond(context, buildEffectsList(request, isPreview), response);
if (!responseSent)
}
}
Hope this helps you.
Best regards,
Stefan