hdwebpros
hdwebpros

Reputation: 650

mod_expires doesn't work with mod_pagespeed enabled

When trying to perform well in Google's Pagespeed insights, we've hit a situation.

We enabled mod_pagespeed and that worked. It did what it's supposed to do.

However, when looking at the results, on GT Metrix and Pagespeed Insights when we have mod_pagespeed enabled, mod_expires and browser caching doesn't work.

Is this by design? If so, is there anything globally or via .htaccess to I can code in to make browser caching happen?

Upvotes: 2

Views: 641

Answers (2)

IXN
IXN

Reputation: 183

Here is an answer, by Matthias Redl-Mann, I discovered in google products forum:

So I could solve the problem: The apache user had no access to the cache directory. Setting a different Cache Path via the ModPagespeedFileCachePath directive solved the problem. After setting a path with access for the apache user, everything worked.

Upvotes: 2

czokalapik
czokalapik

Reputation: 31

I have same problem, also my css links that are indeed moved to footer by pagespeed's prioritize_critical_css are causing render-blocking error. It happens even if I set pagespeed to ONLY do above-the-fold css optimization:

<IfModule pagespeed_module>
ModPagespeed On
ModPagespeedRewriteLevel PassThrough
ModPagespeedEnableFilters prioritize_critical_css
</IfModule>

When I set ModPagespeed Off, problem dissapears... For now I see browser caching warning for png images mostly (I have mod_expires set to "access 1 year", but when I'm trying to use extend_cache in pagespeed instead mod_exipre, even more browser caching warnings appear).

After some google search i found this removed the warning from insights:

ModPagespeedInPlaceResourceOptimization off

Docs on In-Place Resource Optimization.

Upvotes: 2

Related Questions