Volumio2 icon indicating copy to clipboard operation
Volumio2 copied to clipboard

Have album art understand etags instead of using cache-control headers

Open gmerrall opened this issue 4 years ago • 0 comments

One of the issues with cache control is that it's time based and doesn't understand the concept of change. If you change folder art especially, your browser may not update art. This is also a problem since music browsing is an SPA so you can't easily refresh. You're kind of stuck waiting for the cache to clear or you need to clear your browser cache.

Can I suggest switching to eTags. eTags understand the concept of file change as an eTag is simply a hash of some property or properties of files (i.e. file content hash + file mtime). Serving an If-Match header associated with the eTag allows the browser to refresh the image at the time the file changes. I believe this would be a more suitable approach, especially when users are setting up or modifying their music library.

I do note that eTags are served in the response to /albumart which might be inserted by Express but should be possible to manage.

gmerrall avatar Aug 04 '21 07:08 gmerrall