Browser caching shows as failed for naked domain


In my attempt to achieve 100% scores under all performance metrics, I’ve come a longer way than I had initially expected, and my site (well, my fiance’s site) scores a nice green tick mark in EVERYTHING now ( see ) except for one: The site’s naked domain shows up as uncached for Cache Static. Here’s the information provided in the details:

Leverage browser caching of static assets: 96/100
FAILED - (No max-age or expires) -

I don’t know what might be causing this, as when I visit the site’s main page after clearing cache, it takes a bit of time, but any subsequent visits do appear promptly enough, indicating the cache is working. Where am I going wrong?

I’m running WordPress v4.6.1 with Autoptimize 2.1.0 on a Digital Ocean droplet running Ubuntu 16.04.1 LTS x64 with a stack of nginx v1.10.0 + PHP7-FPM v7.0.11-1 (with Zend Engine v3.0.0 for Zend OPcache v7.0.11-1) + MariaDB v10.1.17 + Redis Server v3.0.7 for both object cache as well as full page cache.

As I’ve come this long to achieve an OK for every single thing other than this, I’d like to get rid of this red cross too. Any help in this regard will be immensely appreciated.

Haroon Q. Raja

You just need to add browser caching expire times for html file types in nginx. If the site changes often it might be best to keep the expiry time low eg 4 hours.

When you say you cleared the cache are you referring to clearing the browser’s cache or the page cache within WordPress? As these are different (page caching is serve side where as browser caching is on the client’s side).

I would test the site without the CDN as you will probably get a better load time. Try testing the site without autoptimize and object caching (with page caching turned off) to see if these are affecting the first byte time as there is an up to 2s delay on inside pages that don’t have a cached version ready.

Hello clubberz,

Thanks for the suggestions. That little red mark appears to have gone away by itself in subsequent tests after I did some further tuning (like enabling compression for fonts at my server level, and then serving them all from the CDN; a few were previously being served from the main URL due to Autoptimize…had to apply a filter to take care of that.)

It feels great to have all the marks ticked now, with 100/100 in all performance metrics. In case you’d like to see, here’s the link:

PS: By clearing the cache, I meant clearing all caches at the server level, and then loading the page from a new Incognito tab on my browser, to make sure nothing cached at the server or browser level remains.

That’s strange, not sure why it doesn’t display a cross or a tick for the html file now.

The cache static column refers to the expiry time set for browser caching (not related to server side page caching) and can help to speed up repeat visits, as the browser will get the version stored in its cache instead of connecting and re-downloading the file from the server. You would need to add the expiry rules to the nginx.conf file and reload the nginx service to have them be applied though.

It does appear the CDN could potentially be slowing down the site so recommend doing some tests with and without it enabled to see if it’s worth it.

Not sure either what might be causing that, as according to my knowledge, my server is configured to set the appropriate caching headers for all the files it serves. Though I’m gonna look into it again to make sure that really is the case. Thanks for the suggestion.

Thanks for recommending that. I just tried five tests with CDN and five without it, and here are the average results of some key metrics:


First view
Load time: 2.9516
First byte: 0.2438
Start render: 1.0532
Fully loaded: 3.1966

Repeat view
Load time: 1.274
First byte: 0.190
Start render: 0.9318
Fully loaded: 1.274


First view
Load time: 2.7788
First byte: 0.231
Start render: 0.9542
Fully loaded: 3.0004

Repeat view
Load time: 1.4266
First byte: 0.2212
Start render: 0.8536
Fully loaded: 1.4266


First view
Load time: 0.1728
First byte: 0.0128
Start render: 0.099
Fully loaded: 0.1962

Repeat view
Load time: -0.1526
First byte: -0.0312
Start render: 0.0782
Fully loaded: -0.1526[/quote]

As you can see, using no CDN results in improved first view, while using one favors repeated views. Also, considering how the differences are marginal even when it comes to the first view, I think sticking with the CDN would be a good idea, because of the benefit of serving multiple geographical locations with similar results, and saving on the more expensive server bandwidth cost compared to the CDN bandwidth cost.

Are there any further potential improvements you could suggest?