Why does google mark me as having an inefficient cache policy?

Discussion of non-phpBB related topics with other phpBB.com users.
Forum rules
General Discussion is a bonus forum for discussion of non-phpBB related topics with other phpBB.com users. All site rules apply.
Post Reply
alumnoxxi
Registered User
Posts: 76
Joined: Mon Jul 13, 2020 11:01 pm

Why does google mark me as having an inefficient cache policy?

Post by alumnoxxi »

If you are new to the thread go straight to edit2

I have tried to cache the static resources of phpBB, activating Apache mod_expires

a2enmod expires

Then restart apache, I even tried to restart the server but the current cache configuration that I have is not being applied, this configuration is applied at the .htacces level (the one that is in / config), attached photo of my current configuration (edited with the current config)
<IfModule mod_expires.c>
ExpiresActive On

# Images
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"

# Video
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/mpeg "access plus 1 year"

# CSS, JavaScript
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"

# Others
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
</IfModule>
And here we check that if the cache policy is applied to give an example, it should expire in a month and expire the same day. I also checked it with google speedInsight and effectively no cache policies were being applied

Image
For .gif files the expires directive is not specified ...
It is clear that something is wrong, initially instead of doing it in the .htacces try to implement the cache at the server level, but the file where expires.conf should be done inside /etc/apache2/mods-available/expires.conf, but This file did not exist by default, should I create it? It may have something to do with the failure

However with ae2enmod expires, check that indeed the module was activated.

Finally, for phpBB and in general, do you think the cache will be more effective at the .htacces or server level?

Edit1:Ok the mistake was that it had apache value of AllowOverride none instead of all. Of all formal at the end I will not do it through .htacces since it causes an unnecessary overload to the server and being a vps and having access to httpd.conf / apache2.conf it is better to apply the changes there, correct me if I am wrong
*******SOLVED the main topic
NEW ISSUE
Edit2: Solved, in the end I made the configuration at the virtualHost level and the ttl are already correct, however I still have doubts about why Google on its website GoogleSpeedInsight continues to mark the cached resources as they continue to have an ineffective cache policy, if any moderator considers it appropriate, I open another thread.

Attached photo with what I mean:

Image
Last edited by alumnoxxi on Mon Aug 03, 2020 2:49 pm, edited 5 times in total.
User avatar
janus_zonstraal
Registered User
Posts: 4798
Joined: Sat Aug 30, 2014 1:30 pm

Re: Apache mod_expires cache policy does not apply ** Speedup google PageSpeedInsight **

Post by janus_zonstraal »

(the one that is in / config)
Why?
Just put it in the .htaccess that is in the "/" of your server.
Sorry! My English is bat ;) !!!
User avatar
AmigoJack
Registered User
Posts: 5774
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Apache mod_expires cache policy does not apply ** Speedup google PageSpeedInsight **

Post by AmigoJack »

Don't make screenshots when they only contain text - quote the text instead.
alumnoxxi wrote:
Mon Aug 03, 2020 1:53 am

Code: Select all

ExpiresByType text/html "access 1 month"
That will create problems like "I just made a post but can't see it anywhere" because each page of your board is essentially text/html and each internet browser now will cache every page for... suprise: 1 month.
alumnoxxi wrote:
Mon Aug 03, 2020 1:53 am

Code: Select all

ExpiresByType application/x-shockwave-flash "access 1 month"
Shockwave/Adobe's Flash is dead and there is no chance such content will change ever again - you can easily set this to 100 years. Are there even internet browsers nowadays that still support it?
alumnoxxi
Registered User
Posts: 76
Joined: Mon Jul 13, 2020 11:01 pm

Re: Apache mod_expires cache policy does not apply ** Speedup google PageSpeedInsight **

Post by alumnoxxi »

janus_zonstraal wrote:
Mon Aug 03, 2020 6:28 am
(the one that is in / config)
Why?
Just put it in the .htaccess that is in the "/" of your server.
Ok the mistake was that it had apache value of AllowOverride none instead of all. Of all formal at the end I will not do it through .htacces since it causes an unnecessary overload to the server and being a vps and having access to httpd.conf / apache2.conf it is better to apply the changes there, correct me if I am wrong
alumnoxxi
Registered User
Posts: 76
Joined: Mon Jul 13, 2020 11:01 pm

Re: Apache mod_expires cache policy does not apply ** Speedup google PageSpeedInsight **

Post by alumnoxxi »

AmigoJack wrote:
Mon Aug 03, 2020 9:44 am
Don't make screenshots when they only contain text - quote the text instead.
alumnoxxi wrote:
Mon Aug 03, 2020 1:53 am

Code: Select all

ExpiresByType text/html "access 1 month"
That will create problems like "I just made a post but can't see it anywhere" because each page of your board is essentially text/html and each internet browser now will cache every page for... suprise: 1 month.
alumnoxxi wrote:
Mon Aug 03, 2020 1:53 am

Code: Select all

ExpiresByType application/x-shockwave-flash "access 1 month"
Shockwave/Adobe's Flash is dead and there is no chance such content will change ever again - you can easily set this to 100 years. Are there even internet browsers nowadays that still support it?

You are absolutely right, I did not pay attention to the truth, I was following the following 'guide' to improve the general speedup

viewtopic.php?t=2230216
Post Reply

Return to “General Discussion”