WordPress Browser Cache with W3-Total-Cache doesn’t show new posts [closed]

There are two steps necessary to make sure that the browsers fetch the updated HTML pages (ex: home page).

Step 1

Uncheck ‘Set expires header’ at your site’s wp-admin/admin.php?page=w3tc_browsercache#html_xml, for ‘HTML & XML’ files.

Whenever a browser sees an Expires header, it (the browser) will fetch the next version of that particular HTML page only after it expires. The Expires header specifies a date after which a resource (home page / HTML page) is invalid.

Step 2

In your site’s ‘Browser Cache’ at wp-admin/admin.php?page=w3tc_browsercache#html_xml, for ‘HTML & XML’ files, the ‘Cache Control Policy’ should probably be ‘cache with max-age and validation (“max-age=EXPIRES_SECONDS, public, must-revalidate, proxy-revalidate”).

Like the ‘expires’ header, the max-age header specifies how long a resource (home page / HTML page) is valid after it is downloaded.

When using this cache control policy, W3 Total Cache would additionally send two headers…

  1. Last-Modified header
  2. ETag header

The use of ETag is redundant (IMO), when Last-Modified header is present. So, it is safe to remove ETag header after it is generated by W3 Total Cache.

When the home page is not updated and when browsers tries to fetch the same page that is already in the browser cache, the W3 Total Cache sends 304 Not Modified status code. If the home page is updated and if the browsers tries to fetch the same page that is already in the browser cache, W3 Total Cache sends the updated home page with the updated Last-Modified and ETag headers.

For more details on Expires and max-age headers, please check out… https://developers.google.com/speed/articles/caching

If you use Firefox, you may use Live HTTP Headers add-on to check how all the above headers work in real time.

Leave a Comment

tech