Worst HTTP Cache Policy Ever. Please Beware!

Browser cache is suppose to be used for the static files. However, some bad .htaccess rule often set aggresive TTL for the HTML document that is completely wrong and worst for user-experience.

Example of such rules… you may find in your .htaccess files.

ExpiresDefault "access plus 1 month"

ExpiresDefault A2592000

ExpiresByType text/html "access 1 month"


This type of rule often being added by some stupid plugin… One of them, example is Breeze.

Even after multiple report, author don’t care at all.

Related
https://wordpress.org/support/topic/warning-breeze-sets-a-dangerous-default-30-day-browser-cache-affects-webpages/

https://wordpress.org/support/topic/cache-not-updating/

https://wordpress.org/support/topic/sorry-dear-this-is-not-acceptable/

How to check if your site is affected by long TTL browser cache policy?

  • Check HTTP response header of the first HTTP request that is for HTML

If you see there is cache-control:max-age=2592000

  • Try Pingdom, check first HTTP request response.

I don’t understand the logic, why they set 30 days cache for HTML. As it is dynamic form of request, suppose to be updated often.

How to fix?

  1. First check, who is responsible for serving your web page? Is it CDN, Is it cache plugin?

  2. Just go through it.

  3. Check .htaccess file properly

How to prevent from this problem?

  • Please do not add random .htaccess rule in your site. More .htaccess likely to be more slower website, higher CPU usage. Beware!!

  • Do not use untrustworthy plugin.

Thanks & Regards,
Gulshan

13 Likes