Check Cache-Control of all CSS, JS and image files on a page
check browser caching for all assets | show cache headers of css and js files | serve static assets with an efficient cache policy | which files are not cached | curl | cache-control | browser-caching | assetscurl -s https://example.com/ | grep -oE '(src|href)="[^"]+\.(css|js|woff2?|jpe?g|png|gif|webp|avif|svg)(\?[^"]*)?"' | cut -d'"' -f2 | sed -E 's#^//#https://#; s#^/#https://example.com/#' | grep '^http' | sort -u | while read -r a; do printf '%-45s %s\n' "$(curl -sI "$a" | grep -i '^cache-control:' | tr -d '\r')" "$a"; doneExtracts stylesheets, scripts, fonts and images from the HTML, turns root-relative paths into absolute URLs and requests the Cache-Control header for each file. Static assets should be cached for a long time (a max-age of one year for versioned files). An empty left column means no Cache-Control is set.
Note: Relative paths without a leading slash and files loaded via CSS or JavaScript are missed. The entry on browser caching headers in the nginx category checks individual URLs.
Also searched as
- check browser caching for all assets
- show cache headers of css and js files
- serve static assets with an efficient cache policy
- which files are not cached