brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: curl -I shows the cache headers a browser gets for a file

Cache
~/tips/tip-cache-curl-head-cache-headers

curl -I https://example.com/style.css

Prints the response headers that decide how long browsers and proxies may keep a file.

Before I blame the browser for stale files, I look at what the server told it.

curl -I https://example.com/style.css
curl -sD - -o /dev/null https://example.com/style.css

Look for Cache-Control (how long a copy stays fresh), ETag and Last-Modified (validators for a cheap recheck), and Age when a CDN or proxy sits in between. -I sends a HEAD request, and some setups answer HEAD differently from GET. The second form does a normal GET, prints the headers with -D - and throws away the body. A missing Cache-Control leaves the freshness decision to the browser, which uses a guess based on Last-Modified.

Further reading: MDN: Cache-Control header

Going deeper: Guide: your Unraid cache is full and Docker stopped, how to find out why and fix it

More Cache tips fincore /var/lib/example/data.db npm cache verify fc-cache -f -v ~/.local/share/fonts proxy_cache app; Cache-Control: no-cache All Cache tips (24) All topics

Link