Image thumbnails broken when pragma: no-cache is set by browser
Problem reported by Alexandre Boucher - 8/25/2016 at 8:44 AM
Some browser, like Chrome, lets you put a pragma: no-cache header in HTTP Requests by checking the Disable Cache option in the developer tools. Unfortunately, this also breaks the image previews in the File Explorer, making the request to an URL like /filemanager.ashx/GetThumbnail?maxSize=90&cacheKey=png-3617-1472136022406 fail and returning the following response with status code 200:
{"Message":"Parameter stateId is not received, browser failed to send custom headers."}
In other browsers like MS Edge, when refreshing the page using CTRL+F5 to prevent browser cache, the same thing happens. I was able to reproduce on the GleamTech demo pages too.

2 Replies

Reply to Thread
Cem Alacayir Replied
Employee Post
Yes, FileManager uses a smart trick for aggressive caching of thumbnails however this has a side effect when browser cache is disabled. Actually the trick is about authentication and caching together, i.e. first a request is made with state parameter so that the request is authenticated and browser caches the result, then a second request is made with a permanent cachable url and it's expected that browser loads the image directly from cache and not send a request to the server. This way for subsequent sessions, for example when you close the browser and reopen it, the thumbnails are loaded instantly (unless the source file is modified).
Developer Tools is not an issue because you opt-in to disable caching but yes some browsers can be confused when you press CTRL+F5 but if you press Enter in the address bar (revisit) the effect should be fixed automatically.
Maybe we can find a better way without side effects in future versions.
Cem Alacayir Replied
Employee Post
FYI, this is now fixed in FileUltimate 5.9.5:
Fixed: Thumbnails sometimes appeared blank in FileManager especially in Chrome. Also improved lazy loading of thumbnails with better “in viewport” detection. Also fixed CTRL+F5 (or “disable cache” in developer tools) causing broken images issue.

Reply to Thread