Lots of people are onto using Google’s pagespeed insight and gtmetrix,
You’ll often get a results saying some URLs need an expires header. It will be dragging down your score, and you hate the big fat F … FAIL .. Loser score you get attributed.
But what do these expires headers do ?
It does NOT effect the first visit to the page. HUH !! surely that’s what those reports are about . Nope, has no effect first time, as how can you have a cached version on your PC already.
It does effect subsequent visits, like you come back tomorrow or next week. And it does effect the next page you click.
My recommendation is to have them set just enough for most users session on your WordPress site.
You can’t set the headers on the WordPress pages. The WordPress pages are set to expire immediately, one view, for one user, once.
The expires-headers are only for all the rest of the junk on the page, like images, css and js.
The little assets like images, css and css use little or no resources from your WordPress hosting. It takes almost no time and CPU or memory for those assets to be sent to the user. So you’re not scaling your server more. It’s the big and slow in comparison WordPress pages that hog all the resources.
If your site has regular changes, then have some users with different versions of files is going to cause headaches. Once a user has an asset, say a CSS file that has a month expiry set, and the developer changes it then the user is stuck with the old version.
This can be avoided with putting in a version number in the the resource url, like mystyle.css?ver=12
I think they are really a hangover from when the world wide web (yes, in the old days) had a lot more caching. At one staging ISPs and corporates ran large caching servers to speed up the web. Those large caches would hold those assets for longer, and it would help load time on your server.
If you have an ‘origin pull’ CDN like cloudflare these Expires-Headers are a double edged sword: