Audiofiles: Serve static assets with an efficient cache policy
-
Hey!
I’m using LiteSpeed Caching’s “Browser Cache Settings” to enable browser cache, improve performance and make Google Lighthouse happy.
It enables browser caching via .htaccess for many file type, including jpg, png, fonts and so on.
It appears, though, that many audio file types are not present in the .htaccess file, and, causing Google Lighthouse to suggest “Serve static assets with an efficient cache policy”
I’m using the standard Gutenberg Audio Block (a HTML Audio Element) for my audio, nothing special there.
The following addition to .htaccess solved the problem:
### SW-CUSTOM-BROWSER-CACHE start ### <ifModule mod_headers.c> <filesMatch ".(mp3|opus|aac)$"> Header set Cache-Control "max-age=31536000, public" </filesMatch> </ifModule> ### SW-CUSTOM-BROWSER-CACHE end ###
Maybe the LiteSpeed Browser Cache Settings, could take care of audio as well, so I don’t have to? ??
Kind regards
BjarneThe page I need help with: [log in to see the link]
- The topic ‘Audiofiles: Serve static assets with an efficient cache policy’ is closed to new replies.