↑ ↓ select, Enter open, Esc close

Check the browser caching headers of a file

Adjust the values, the command updates live
user@server
curl -sI https://example.com/wp-includes/css/dist/block-library/style.min.css | grep -iE "^(cache-control|expires|etag|last-modified|age):"

Requests the headers of a URL and filters out the cache-related ones. For static files such as CSS, JS and images, Cache-Control should contain a long max-age, whereas HTML pages are usually cached briefly or not at all. Without these headers, the browser reloads the file on every visit or at least revalidates it.

Note: On Plesk with the nginx proxy, the option for caching static files determines whether nginx or Apache sets the headers.

Also searched as

  • check browser caching headers
  • show cache-control header curl
  • is expires header set
  • pagespeed serve static assets with an efficient cache policy

Related one-liners

All in nginx

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.