What cache validators are
A cache validator lets a browser ask the server "has this file changed?" instead of downloading it again. There are two kinds:
- Last-Modified. The date of the last change of the file.
- ETag. A unique tag for the version of the file. It is more exact.
If a file has neither, the browser must download it again every time. Tools such as PageSpeed Insights then show the warning.
Find the affected files
Run your site through PageSpeed Insights or GTmetrix. The report lists the resources without a validator.

Most web servers send these headers by default for static files. If yours does not, add them.
Apache
Enable the mod_headers and mod_expires modules. Add this to your .htaccess or your site config:

# Keep the default ETag and Last-Modified for static files
<IfModule mod_headers.c>
FileETag MTime Size
<FilesMatch "\.(html|css|js|jpg|jpeg|png|gif)$">
Header set Cache-Control "public, max-age=31536000"
</FilesMatch>
</IfModule>

FileETag MTime Size makes Apache add an ETag from the modified time and the size. Apache sends Last-Modified for static files on its own.
Nginx
Nginx sends Last-Modified and ETag for static files by default. Make sure they are on, and add cache headers:
location ~* \.(html|css|js|jpg|jpeg|png|gif)$ {
etag on;
if_modified_since exact;
expires 1y;
add_header Cache-Control "public";
}

Then test the config and reload:
sudo nginx -t
sudo systemctl reload nginx
Improve caching
- Cache-Control. Set a long lifetime for static files that do not change:
Cache-Control: max-age=31536000, public
- CDN. A CDN adds the right headers and serves files from many places.
- Cache policy. Use short times for pages that change and long times for versioned assets.
Check the result
Test a file:
curl -I https://example.com/style.css
The answer should show Last-Modified or ETag.
Quick recap
- Static files need
Last-ModifiedorETag. - Apache and Nginx can add both.
- Check with
curl -I.