Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Static assets without long cache lifetimes: how to fix it

PRF-056Low impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

Every file your server sends comes with HTTP headers. The Cache-Control header tells the browser, and any CDN in between, how long it may reuse the file without asking again. max-age=31536000 means one year, in seconds.

The issue is present when logos, product images, stylesheets, scripts or fonts have no cache header, max-age=0, no-cache, or a lifetime of a few minutes or hours. Tools like Lighthouse report this as "Serve static assets with an efficient cache policy".

Why it costs you leads or sales

Without long cache lifetimes, a returning visitor re-fetches the same logo, theme CSS and scripts on every page. That adds requests and wait time on the second, third and fourth step of a funnel: landing page, product page, cart, checkout.

The effect is usually modest, which is why the business impact is rated low. First-time visitors are not helped by browser caching at all. But slow repeat views hurt people who compare options, come back from an email, or click through several pages. It also wastes bandwidth and server capacity.

Data downloaded on a repeat page viewExample numbers
Data downloaded on a repeat page view (example)Short or no cache lifetime: 1,800 KB; Long cache lifetime: 120 KB06901,3801,800120Short or no cache lif…Long cache lifetimeKB

Example: a page with 1,800 KB of static files. With long cache lifetimes the browser reuses most of them on the next page. Numbers are illustrative.

A returning visitor with no long cache
  1. Landing pageCSS, JS and images downloaded
  2. Product pageSame files re-requested
  3. CartSame files re-requested again
  4. CheckoutSlower render, more waiting

The files are fetched again at each step, so every page waits on the network.

How to check if your site has it

Check cache headers in your browser
  1. Open DevTools

    In Chrome, press F12 and open the Network tab. Tick Disable cache off, then reload the page.

  2. Inspect a static file

    Click a CSS, JS, image or font file and open the Headers tab. Find Cache-Control under Response Headers.

  3. Compare with the table below

    No header, max-age=0, no-cache or a value under a few days on a versioned file is a problem.

  4. Run Lighthouse

    In DevTools open Lighthouse, run a Performance report and look for "Use efficient cache lifetimes" or similar. It lists the files and their current lifetime.

  5. Or use curl

    Run curl -I https://example.com/path/to/file.css and read the cache-control line.

What to look for in the Cache-Control header
Header valueMeaningVerdict for versioned static files
(missing)Browser guesses its own lifetimeFix
no-storeNever keep a copyFix
no-cache or max-age=0Must re-check every timeFix
max-age=3600Reuse for 1 hourToo short
public, max-age=31536000, immutableReuse for 1 year, never re-checkGood

How to fix it

The rule: give a long lifetime to files whose URL changes when the content changes (for example app.3f9a1c.js or style.css?ver=6.5). Give a short lifetime, or revalidation, to files that keep the same URL and may be replaced, such as /logo.png.

Set long cache lifetimes by platform
  1. Use your cache or performance plugin

    Most caching plugins have a browser caching or static file expiry option. Turn it on and choose a long expiry for CSS, JS, images and fonts. Menu names vary by plugin.

  2. Or add rules to .htaccess (Apache)

    Add the Apache snippet from the code section below above the # BEGIN WordPress block. It needs mod_expires and mod_headers enabled.

  3. On Nginx hosting

    Ask your host or edit the server block using the Nginx snippet below. Managed hosts often set this in their control panel.

Apache (.htaccess): long cache for static file typeshtaccess
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType font/woff2 "access plus 1 year"
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
</IfModule>
<IfModule mod_headers.c>
  <FilesMatch "\.(css|js|woff2|webp|jpe?g|png|svg)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
</IfModule>
Nginx: long cache for static file typesnginx
location ~* \.(css|js|woff2|webp|jpe?g|png|svg|gif|ico)$ {
    add_header Cache-Control "public, max-age=31536000, immutable";
    access_log off;
}

How to confirm it's fixed

Confirm the new cache lifetimes
  • Reload the page with DevTools open and check Cache-Control on a CSS, JS, image and font file.
  • Reload again normally. Files should show (memory cache) or (disk cache) in the Size column.
  • Run curl -I on a few static files and confirm max-age=31536000 where expected.
  • Re-run Lighthouse and confirm the cache lifetime warning is gone or shorter.
  • Change a CSS or JS file, deploy, and check visitors get the new version because the file name or version changed.

How to prevent it happening again

Headers often break when you change host, plugin, CDN or build setup. Keep file versioning in your build, and keep your cache rules in one place, such as the server config or CDN rules, rather than split across plugins.

Habits that keep caching healthy
  • Re-run Lighthouse after every hosting, CDN or caching plugin change.
  • Add new third-party scripts only after checking their cache headers.
  • Use hashed or versioned file names for every file you edit often.
  • Review the Network tab headers after each major theme update.

How FunnelGuard handles this

FunnelGuard does not check this yet. Cache lifetimes on static assets are a possible future check, but today it does not read or report on them.

What FunnelGuard does do is run your real customer journeys on a schedule, such as lead forms, checkouts and booking buttons, from the EU or the US. It checks each step, the tracking hits sent to ad and analytics platforms, and whether test leads reach your inbox and CRM. That covers whether the funnel works, not how its files are cached.

Questions people ask

What is a good Cache-Control max-age for static assets?

For files whose names change when the content changes, such as hashed CSS and JS, use public, max-age=31536000, immutable (one year). For files with a fixed name, use a shorter lifetime such as a day, or revalidate them with an ETag.

Why does Lighthouse say 'Serve static assets with an efficient cache policy'?

It means some of your images, scripts, styles or fonts are sent with a missing or short cache lifetime. Browsers must download them again on repeat visits. Set a longer Cache-Control: max-age on those files to clear the warning.

How do I check cache headers for a file on my website?

Open Chrome DevTools, go to the Network tab, reload and click a file, then read Cache-Control under Response Headers. You can also run curl -I followed by the file URL and look for the cache-control line.

How do I enable browser caching in WordPress?

Turn on browser caching or static file expiry in your caching plugin, or add Expires and Cache-Control rules to .htaccess on Apache or the server block on Nginx. Many managed hosts also offer a setting in their control panel.

Will a one-year cache stop visitors seeing my updated CSS or JS?

It can if the file name stays the same. Use a version or content hash in the file name or URL so a change creates a new URL. Then the long lifetime is safe, because the browser fetches the new file.

Does browser caching affect SEO or conversions?

It mainly speeds up repeat visits, which can help people moving through several funnel pages. It does not help first-time visitors, so the impact is usually small compared with fixes such as image size or server response time.

Can I change cache headers on Shopify, Wix or Squarespace?

Not for the platform's own files. Those platforms set the headers on their CDNs and offer no setting for them. You can only control files you host yourself and review third-party scripts you add.

Does FunnelGuard check cache headers on my static files?

No. FunnelGuard does not check this yet, though it is a possible future check. Use Lighthouse, PageSpeed Insights or a HAR export from your browser to review cache headers.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.