Some resources are limited to 5 minutes cache

67 views
Skip to first unread message

Ungov

unread,
Apr 8, 2018, 5:50:41 AM4/8/18
to mod-pagespeed-discuss
So I finally got pagespeed to work, but then I noticed that PageSpeed Insights and GTMetrix are reporting that some resources are only cached for 5 minutes, triggering the famous "leverage browser caching"
Files are .css files and .js

Of course I enabled all pagespeed cache features

I tried adding this to my nginx conf but it didnt help:


location ~* ^.+.(js|css|gif|ico|zip|tgz|gz|rar|bz2|iso|doc|xls|exe|pdf|ppt|tar|m$
    expires 30d;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}


I also tested disabling Cloudflare and clearing cache

Otto van der Schaaf

unread,
Apr 8, 2018, 8:41:18 AM4/8/18
to mod-pagesp...@googlegroups.com
The 5 minute expiry may be transient, the module emits that when it is still working on wrapping up optimizations in the background. 

Otto

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/795286dd-b407-46f9-8061-2ec77eab52b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ungov

unread,
Apr 8, 2018, 2:57:03 PM4/8/18
to mod-pagespeed-discuss
Hi,

The module has been activated for over 48 hours now and I'm still facing the same problem.
I tested on a production website with 15k unique visitors daily but it's still not generating the optimizations with proper cache control.


It's always the same 3 files that are triggering "leverage browser caching" warnings:

Otto van der Schaaf

unread,
Apr 8, 2018, 2:59:11 PM4/8/18
to mod-pagesp...@googlegroups.com
If you add PageSpeedFilters=+debug on the querystring, diagnostic information may be written into the html following the files you mention. Does that provide any clues?

Otto

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

Ungov

unread,
Apr 8, 2018, 3:49:06 PM4/8/18
to mod-pagespeed-discuss
I don't see any relevant information when adding ?PageSpeedFilters=+debug
I have also checked the pagespeed_admin messages log, but I can't find anything related to these specific .css files
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Otto van der Schaaf

unread,
Apr 8, 2018, 4:52:31 PM4/8/18
to mod-pagesp...@googlegroups.com
I took a look at https://scripts.ni-dieu-ni-maitre.com/css/plugins/tooltipster/sideTip/themes/tooltipster-sideTip-borderless.min.css
CF running in front of the server makes things a bit harder to assess, but one thing I noticed is that the following response header persists:

"cache-control:max-age=300, s-maxage=10"

PageSpeed should only emit "s-maxage=10" when it is isn't ready to emit the fully optimized response yet.
It does that  to prevent caching proxies (like the ones from CF) from keeping intermediate results in cache for long periods.

What I would suggest is taking CF out of the equation temporarily so you can test the module separately.
If the problem still persists after that, upgrading to the latest stable may help. (And doing so probably is a good idea regardless).

Otto


To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/b0ed5332-e037-46a5-a23c-b638ec0400af%40googlegroups.com.

Ungov

unread,
Apr 8, 2018, 5:42:07 PM4/8/18
to mod-pagespeed-discuss
Thanks for the reply,
I have disabled Cloudflare and updated pagespeed to latest stable, but now I am getting even more errors
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Otto van der Schaaf

unread,
Apr 8, 2018, 5:58:55 PM4/8/18
to mod-pagesp...@googlegroups.com
One example of the debug output for one of the images that have a short cache TTL (navicon1.png):

<img src="https://www.ni-dieu-ni-maitre.com/images/navicon1.png" class="navicon1 mobile-hide" alt=BOUTIQUE style="position:relative; left:2px;"/><!--4xx status code, pre\
venting rewriting of https://www.ni-dieu-ni-maitre.com/images/navicon1.png--><!--4xx status code, preventing rewriting of https://www.ni-dieu-ni-maitre.com/images/navico\
n1.png-->

It looks like the module has trouble fetching its inputs. You may want to check https://www.modpagespeed.com/doc/https_support
Ensuring the module is able to get to the css/js/images will probably fix most if not all of the remaining complaints.

The other remaining complaint by PSI I saw is that the first byte of the html is slow. Maybe that one resolves when CF is back into the equation.

Otto


To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/223dabca-cc74-49e6-9302-8280f00ee42d%40googlegroups.com.

Ungov

unread,
Apr 8, 2018, 6:19:47 PM4/8/18
to mod-pagespeed-discuss
Oh, I can see the pagespeed debug output now. I assume that Cloudflare was removing comments from html for some sort of optimizations.

Not sure why you are getting 404 errors, but this file is working for me: https://www.ni-dieu-ni-maitre.com/images/navicon1.png

However if i test with CURL in SSH, I get this:
HTTP/1.1 405 Not Allowed
Server: nginx
Date: Sun, 08 Apr 2018 22:17:08 GMT
Content-Type: text/html
Content-Length: 166
Connection: keep-alive

I'm not sure if this is related or not, but this specific image (navicon1.png) was flagged as needing css sprites optimization by GTMetrix. So I tried to enable Pagespeed CSS sprites, but this didn't work. I've read that pagespeed only supports css sprites with images that are defined as css background (which is not my case) so that may be why.

Otto van der Schaaf

unread,
Apr 8, 2018, 6:32:46 PM4/8/18
to mod-pagesp...@googlegroups.com
The css background spriting documentation (including limitations and preconditions) are here:

mod_pagespeed needs to be able to fetch its inputs,  and is getting the 404, not me.
Correcting that should improve things. The 405 response you observed for the sample image I posted (navicon1.png)
might be related to the module not being able to fetch its inputs. You may be able to reroute mod_pagespeed, 
see the page about https support I posted earlier (MapOriginDomain, LoadFromFile)

Otto

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

Ungov

unread,
Apr 8, 2018, 7:02:14 PM4/8/18
to mod-pagespeed-discuss
I'm very confused about MapOriginDomain and LoadFromFile ... I had already read the link you posted but failed to understand how to use it for my case. I've read it another time but I'm still confused

I tried this:
pagespeed MapOriginDomain "http://localhost" "https://www.ni-dieu-ni-maitre.com";
#pagespeed LoadFromFile "https://www.ni-dieu-ni-maitre.com" "/home/anarchoi/public_html/";
It caused new 404 errors and didn't fix the issue with navicon1.png

nginx couldn't restart with the second rule
nginx: [emerg] "pagespeed" directive "LoadFromFile" cannot be set at this scope. in /usr/local/nginx/conf/vhost.ssl.d/ngnm.rewrite:16
nginx
: configuration file /usr/local/nginx/conf/nginx.conf test failed

I'm not even sure if http://localhost is working and I don't know how to test. I have multiple websites on this server so I don't know where http://localhost is pointing... 
I also have a few things that will rewrite non-https URL to https:// and also other redirections to redirect users to the main domain if they are not on it. It could interfere with the rerouting.
Does that mean that I would have to make my website accessible through a non-https URL?

If I understand correctly, LoadFromFile is meant only for static resources? So I would have to move all my images to a static subdomain?

Here's my config files if it can help... The only thing I modified in the .conf is that I commented out the cache headers part for PNG and JPG files or else nginx would fail to load dynamic resources (like an image rewritten to a dynamic php file, through rewrite rules)

ni-dieu-ni-maitre.com.conf : https://pastebin.com/SYRRjDT0

Ungov

unread,
Apr 8, 2018, 8:05:47 PM4/8/18
to mod-pagespeed-discuss
Ok I made some progress... realized that I have to put LoadFromFile in the .conf file and not in the rewrite file
I also discovered that a few plugins were disabled by default in my .conf file so I commented it out
doing this seems to have fixed a lot of stuff, now I see .webp are working

Also now if I CURL navicon1.png I get a 200 code... good!

However, I still have the issue with cache expiring after 5 minutes. I will check if it goes away in a few hours.


I used this code in my .conf
pagespeed LoadFromFile https://www.ni-dieu-ni-maitre.com /home/anarchoi/public_html/;
pagespeed
LoadFromFileRuleMatch Disallow \.php;


A new issue is this error in Chrome Console:

(index):17 Uncaught DOMException: Failed to execute 'setItem' on 'Storage': Setting the value of 'pagespeed_lsc_url:https://www.ni-dieu-ni-maitre.com/images/shipping_icon.png pagespeed_lsc_hash:FvvJXlgxd0' exceeded the quota.
    at t
(https://www.ni-dieu-ni-maitre.com/:17:423)
    at u
(https://www.ni-dieu-ni-maitre.com/:18:15)
    at https
://www.ni-dieu-ni-maitre.com/:19:87

What is the "quota" the error is referencing to?

Ungov

unread,
Apr 8, 2018, 10:04:35 PM4/8/18
to mod-pagespeed-discuss
Most features are working now, woohoo! The result was well worth the headaches! 
Cache issues seem to be fixed and i'm back at 100/100 PageSpeed (except sometimes the server response is higher than 200ms for some unknown reason probably not related to PageSpeed).


  1. As for the last error I posted (Uncaught DOMException), according to another thread, it could be due to Chrome caching. I don't use local_storage_cache but I fixed the error by disabling in_place_optimize_for_browser. Is there a better way to fix this error?

  2. .webp are working for static images but not for jpg images dynamically generated by PHP and rewritten as .png. Not sure if this is normal behavior?

  3. Another issue is that as soon as I re-enable Cloudflare, the image thumbs on index.php homepage stop working. Seems to be a conflict with Cloudflare+lazyload_images. As soon as I either turn off Cloudflare or disable lazyload_images, the error goes away and the images aren't broken anymore.
    I have a lot of errors in the console:
index):73 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload ((index):73)
onload @ (index):73
(index):163 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload ((index):163)
onload @ (index):163
(index):174 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload ((index):174)
onload @ (index):174
(index):185 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload ((index):185)
onload @ (index):185
(index):196 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload ((index):196)
onload @ (index):196
(index):207 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload ((index):207)
onload @ (index):207
(...)
For now, I just disabled lazyload_images



Thanks for the support and sorry for multiple posts, I couldn't edit my last reply

Ungov

unread,
Apr 9, 2018, 4:52:41 PM4/9/18
to mod-pagespeed-discuss
Errors are back today :(

  1. I'm still having the "5 minutes cache" issue on a lot of images like this one
    The strange thing is that those images are actually converted to .webp using convert_jpeg_to_webp. When checking the source code of my website, I can see that those images are displayed as .webp ... But why is Google PageSpeed Insights loading the jpeg versions of these images?
    GTMetrix doesn't have this problem and is correctly reporting the .webp as cached images
    I tried disabling Cloudflare and clearing cache but it didn't change anything, so i reactivated it.


  2. errors are back in the console today, even with browser caching modules disabled. The errors are intermittent. Sometimes the page loads without error and sometimes it loads with 150+ errors in the console.
tshirt-orwell-84-0018156674:56 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:56)
onload @ tshirt-orwell-84-0018156674:56
tshirt-orwell-84-0018156674:63 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:63)
onload @ tshirt-orwell-84-0018156674:63
tshirt-orwell-84-0018156674:63 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:63)
onload @ tshirt-orwell-84-0018156674:63
tshirt-orwell-84-0018156674:64 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:64)
onload @ tshirt-orwell-84-0018156674:64
tshirt-orwell-84-0018156674:308 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:308)
onload @ tshirt-orwell-84-0018156674:308
tshirt-orwell-84-0018156674:680 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:680)
onload @ tshirt-orwell-84-0018156674:680
tshirt-orwell-84-0018156674:869 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:869)
onload @ tshirt-orwell-84-0018156674:869
tshirt-orwell-84-0018156674:668 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:668)
onload @ tshirt-orwell-84-0018156674:668
tshirt-orwell-84-0018156674:576 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:576)
onload @ tshirt-orwell-84-0018156674:576
tshirt-orwell-84-0018156674:653 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:653)
onload @ tshirt-orwell-84-0018156674:653
tshirt-orwell-84-0018156674:253 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:253)
onload @ tshirt-orwell-84-0018156674:253
tshirt-orwell-84-0018156674:887 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:887)
onload @ tshirt-orwell-84-0018156674:887
tshirt-orwell-84-0018156674:883 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:883)
onload @ tshirt-orwell-84-0018156674:883
tshirt-orwell-84-0018156674:623 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:623)
onload @ tshirt-orwell-84-0018156674:623
tshirt-orwell-84-0018156674:686 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:686)
onload @ tshirt-orwell-84-0018156674:686
tshirt-orwell-84-0018156674:875 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:875)
onload @ tshirt-orwell-84-0018156674:875
tshirt-orwell-84-0018156674:665 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:665)
onload @ tshirt-orwell-84-0018156674:665
tshirt-orwell-84-0018156674:662 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:662)
onload @ tshirt-orwell-84-0018156674:662
tshirt-orwell-84-0018156674:659 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:659)
onload @ tshirt-orwell-84-0018156674:659
tshirt-orwell-84-0018156674:405 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:405)
onload @ tshirt-orwell-84-0018156674:405
tshirt-orwell-84-0018156674:885 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:885)
onload @ tshirt-orwell-84-0018156674:885
tshirt-orwell-84-0018156674:881 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:881)
onload @ tshirt-orwell-84-0018156674:881
tshirt-orwell-84-0018156674:635 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:635)
onload @ tshirt-orwell-84-0018156674:635
tshirt-orwell-84-0018156674:873 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:873)
onload @ tshirt-orwell-84-0018156674:873
tshirt-orwell-84-0018156674:692 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:692)
onload @ tshirt-orwell-84-0018156674:692
tshirt-orwell-84-0018156674:915 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:915)
onload @ tshirt-orwell-84-0018156674:915
tshirt-orwell-84-0018156674:459 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:459)
onload @ tshirt-orwell-84-0018156674:459
tshirt-orwell-84-0018156674:414 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:414)
onload @ tshirt-orwell-84-0018156674:414
tshirt-orwell-84-0018156674:867 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:867)
onload @ tshirt-orwell-84-0018156674:867
tshirt-orwell-84-0018156674:879 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:879)
onload @ tshirt-orwell-84-0018156674:879
tshirt-orwell-84-0018156674:871 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:871)
onload @ tshirt-orwell-84-0018156674:871
tshirt-orwell-84-0018156674:911 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:911)
onload @ tshirt-orwell-84-0018156674:911
tshirt-orwell-84-0018156674:909 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:909)
onload @ tshirt-orwell-84-0018156674:909
tshirt-orwell-84-0018156674:608 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:608)
onload @ tshirt-orwell-84-0018156674:608
tshirt-orwell-84-0018156674:641 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:641)
onload @ tshirt-orwell-84-0018156674:641
tshirt-orwell-84-0018156674:893 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:893)
onload @ tshirt-orwell-84-0018156674:893
tshirt-orwell-84-0018156674:674 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:674)
onload @ tshirt-orwell-84-0018156674:674
tshirt-orwell-84-0018156674:899 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:899)
onload @ tshirt-orwell-84-0018156674:899
tshirt-orwell-84-0018156674:897 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:897)
onload @ tshirt-orwell-84-0018156674:897
tshirt-orwell-84-0018156674:501 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:501)
onload @ tshirt-orwell-84-0018156674:501
tshirt-orwell-84-0018156674:498 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:498)
onload @ tshirt-orwell-84-0018156674:498
tshirt-orwell-84-0018156674:516 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:516)
onload @ tshirt-orwell-84-0018156674:516
tshirt-orwell-84-0018156674:903 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:903)
onload @ tshirt-orwell-84-0018156674:903
tshirt-orwell-84-0018156674:931 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:931)
onload @ tshirt-orwell-84-0018156674:931
tshirt-orwell-84-0018156674:877 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:877)
onload @ tshirt-orwell-84-0018156674:877
tshirt-orwell-84-0018156674:921 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:921)
onload @ tshirt-orwell-84-0018156674:921
tshirt-orwell-84-0018156674:919 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:919)
onload @ tshirt-orwell-84-0018156674:919
tshirt-orwell-84-0018156674:937 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:937)
onload @ tshirt-orwell-84-0018156674:937
tshirt-orwell-84-0018156674:925 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:925)
onload @ tshirt-orwell-84-0018156674:925
tshirt-orwell-84-0018156674:943 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:943)
onload @ tshirt-orwell-84-0018156674:943
tshirt-orwell-84-0018156674:522 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:522)
onload @ tshirt-orwell-84-0018156674:522
tshirt-orwell-84-0018156674:552 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:552)
onload @ tshirt-orwell-84-0018156674:552
tshirt-orwell-84-0018156674:939 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:939)
onload @ tshirt-orwell-84-0018156674:939
tshirt-orwell-84-0018156674:865 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:865)
onload @ tshirt-orwell-84-0018156674:865
tshirt-orwell-84-0018156674:913 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:913)
onload @ tshirt-orwell-84-0018156674:913
tshirt-orwell-84-0018156674:905 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:905)
onload @ tshirt-orwell-84-0018156674:905
tshirt-orwell-84-0018156674:901 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:901)
onload @ tshirt-orwell-84-0018156674:901
tshirt-orwell-84-0018156674:907 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:907)
onload @ tshirt-orwell-84-0018156674:907
tshirt-orwell-84-0018156674:923 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:923)
onload @ tshirt-orwell-84-0018156674:923
tshirt-orwell-84-0018156674:561 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:561)
onload @ tshirt-orwell-84-0018156674:561
tshirt-orwell-84-0018156674:540 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:540)
onload @ tshirt-orwell-84-0018156674:540
tshirt-orwell-84-0018156674:933 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:933)
onload @ tshirt-orwell-84-0018156674:933
tshirt-orwell-84-0018156674:927 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:927)
onload @ tshirt-orwell-84-0018156674:927
tshirt-orwell-84-0018156674:689 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:689)
onload @ tshirt-orwell-84-0018156674:689
tshirt-orwell-84-0018156674:959 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:959)
onload @ tshirt-orwell-84-0018156674:959
tshirt-orwell-84-0018156674:960 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:960)
onload @ tshirt-orwell-84-0018156674:960
tshirt-orwell-84-0018156674:507 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:507)
onload @ tshirt-orwell-84-0018156674:507
tshirt-orwell-84-0018156674:441 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:441)
onload @ tshirt-orwell-84-0018156674:441
tshirt-orwell-84-0018156674:531 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:531)
onload @ tshirt-orwell-84-0018156674:531
tshirt-orwell-84-0018156674:423 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:423)
onload @ tshirt-orwell-84-0018156674:423
tshirt-orwell-84-0018156674:564 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:564)
onload @ tshirt-orwell-84-0018156674:564
tshirt-orwell-84-0018156674:555 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:555)
onload @ tshirt-orwell-84-0018156674:555
tshirt-orwell-84-0018156674:519 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:519)
onload @ tshirt-orwell-84-0018156674:519
tshirt-orwell-84-0018156674:504 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:504)
onload @ tshirt-orwell-84-0018156674:504
tshirt-orwell-84-0018156674:917 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:917)
onload @ tshirt-orwell-84-0018156674:917
tshirt-orwell-84-0018156674:525 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:525)
onload @ tshirt-orwell-84-0018156674:525
tshirt-orwell-84-0018156674:599 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:599)
onload @ tshirt-orwell-84-0018156674:599
tshirt-orwell-84-0018156674:549 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:549)
onload @ tshirt-orwell-84-0018156674:549
tshirt-orwell-84-0018156674:582 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:582)
onload @ tshirt-orwell-84-0018156674:582
tshirt-orwell-84-0018156674:513 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:513)
onload @ tshirt-orwell-84-0018156674:513
tshirt-orwell-84-0018156674:585 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:585)
onload @ tshirt-orwell-84-0018156674:585
tshirt-orwell-84-0018156674:941 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:941)
onload @ tshirt-orwell-84-0018156674:941
tshirt-orwell-84-0018156674:895 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:895)
onload @ tshirt-orwell-84-0018156674:895
tshirt-orwell-84-0018156674:534 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:534)
onload @ tshirt-orwell-84-0018156674:534
tshirt-orwell-84-0018156674:889 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:889)
onload @ tshirt-orwell-84-0018156674:889
tshirt-orwell-84-0018156674:528 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:528)
onload @ tshirt-orwell-84-0018156674:528
tshirt-orwell-84-0018156674:573 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:573)
onload @ tshirt-orwell-84-0018156674:573
tshirt-orwell-84-0018156674:605 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:605)
onload @ tshirt-orwell-84-0018156674:605
tshirt-orwell-84-0018156674:558 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:558)
onload @ tshirt-orwell-84-0018156674:558
tshirt-orwell-84-0018156674:935 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:935)
onload @ tshirt-orwell-84-0018156674:935
tshirt-orwell-84-0018156674:579 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:579)
onload @ tshirt-orwell-84-0018156674:579
tshirt-orwell-84-0018156674:570 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:570)
onload @ tshirt-orwell-84-0018156674:570
tshirt-orwell-84-0018156674:620 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:620)
onload @ tshirt-orwell-84-0018156674:620
tshirt-orwell-84-0018156674:632 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:632)
onload @ tshirt-orwell-84-0018156674:632
tshirt-orwell-84-0018156674:626 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:626)
onload @ tshirt-orwell-84-0018156674:626
tshirt-orwell-84-0018156674:543 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:543)
onload @ tshirt-orwell-84-0018156674:543
tshirt-orwell-84-0018156674:546 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:546)
onload @ tshirt-orwell-84-0018156674:546
tshirt-orwell-84-0018156674:929 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:929)
onload @ tshirt-orwell-84-0018156674:929
tshirt-orwell-84-0018156674:537 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:537)
onload @ tshirt-orwell-84-0018156674:537
tshirt-orwell-84-0018156674:617 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:617)
onload @ tshirt-orwell-84-0018156674:617
tshirt-orwell-84-0018156674:644 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:644)
onload @ tshirt-orwell-84-0018156674:644
tshirt-orwell-84-0018156674:602 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:602)
onload @ tshirt-orwell-84-0018156674:602
tshirt-orwell-84-0018156674:638 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:638)
onload @ tshirt-orwell-84-0018156674:638
tshirt-orwell-84-0018156674:611 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:611)
onload @ tshirt-orwell-84-0018156674:611
tshirt-orwell-84-0018156674:647 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:647)
onload @ tshirt-orwell-84-0018156674:647
tshirt-orwell-84-0018156674:671 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:671)
onload @ tshirt-orwell-84-0018156674:671
tshirt-orwell-84-0018156674:677 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:677)
onload @ tshirt-orwell-84-0018156674:677
tshirt-orwell-84-0018156674:614 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:614)
onload @ tshirt-orwell-84-0018156674:614
tshirt-orwell-84-0018156674:450 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:450)
onload @ tshirt-orwell-84-0018156674:450
tshirt-orwell-84-0018156674:683 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:683)
onload @ tshirt-orwell-84-0018156674:683
tshirt-orwell-84-0018156674:468 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:468)
onload @ tshirt-orwell-84-0018156674:468
tshirt-orwell-84-0018156674:650 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:650)
onload @ tshirt-orwell-84-0018156674:650
tshirt-orwell-84-0018156674:656 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:656)
onload @ tshirt-orwell-84-0018156674:656
tshirt-orwell-84-0018156674:629 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:629)
onload @ tshirt-orwell-84-0018156674:629
tshirt-orwell-84-0018156674:510 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:510)
onload @ tshirt-orwell-84-0018156674:510
tshirt-orwell-84-0018156674:567 Uncaught ReferenceError: pagespeed is not defined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:567)
onload @ tshirt-orwell-84-0018156674:567
tshirt-orwell-84-0018156674:366 Uncaught TypeError: Cannot read property 'checkImageForCriticality' of undefined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:366)
onload @ tshirt-orwell-84-0018156674:366
tshirt-orwell-84-0018156674:125 Uncaught TypeError: Cannot read property 'checkImageForCriticality' of undefined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:125)
onload @ tshirt-orwell-84-0018156674:125
tshirt-orwell-84-0018156674:891 Uncaught TypeError: Cannot read property 'checkImageForCriticality' of undefined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:891)
onload @ tshirt-orwell-84-0018156674:891
tshirt-orwell-84-0018156674:477 Uncaught TypeError: Cannot read property 'checkImageForCriticality' of undefined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:477)
onload @ tshirt-orwell-84-0018156674:477

5tshirt-orwell-84-0018156674:1 Uncaught TypeError: Cannot read property 'checkImageForCriticality' of undefined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:1)
onload @ tshirt-orwell-84-0018156674:1
32tshirt-orwell-84-0018156674:1 Uncaught TypeError: Cannot read property 'checkImageForCriticality' of undefined
    at HTMLImageElement.onload (tshirt-orwell-84-0018156674:1)

Otto van der Schaaf

unread,
Apr 9, 2018, 4:58:01 PM4/9/18
to mod-pagesp...@googlegroups.com
For the fluctuating PSI measurements, this is probably relevant: https://www.modpagespeed.com/doc/faq#varying-results

For the js errors you observed:
- If you have defer_javascript enabled, you could try turning it off. That filter is classified as high risk and
may be incompatible with scripts on your site.
- If that doesn't help, you can try turning off combine_javascript if it is enabled, to see if that resolves the issue.
I suspect that combining may escalate a preexisting problem in one of javascript files. Turning off combining may help
localizing that issue and keeping its effects minimal. 

Hope that helps!

Otto

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

Joshua Marantz

unread,
Apr 9, 2018, 7:18:46 PM4/9/18
to mod-pagespeed-discuss
defer_javascript could explain some things. If not, the "pagespeed is not defined" issue seems like it might be due to the browser not being able to fetch the PageSpeed helper JavaScript.  Are there any 404 messages prior to the "pagespeed is not defined" errors?  In other words, what's the *first* error you see?

Ungov

unread,
Apr 10, 2018, 3:15:44 AM4/10/18
to mod-pagespeed-discuss
Thanks for the replies, I appreciate your help

Disabling combine_javascript and Cloudflare Rocket Loader fixed the errors in the console so far.
Not sure which javascript file is causing conflicts, as there is never any relevant error in the console.

Most of the times there was ONLY the pagespeed error in the console, no 404 or anything http://prntscr.com/j3692f
(index):56 Uncaught ReferenceError: pagespeed is not defined    at HTMLImageElement.onload ((index):56)

Other times I was getting 100 or 200 of the same errors (still nothing displayed before the error) http://prntscr.com/j3698r

-

The 5 minutes cache issue persists. I followed the recommendations from the wiki and increased cache storage a lot, b
If I disable rewrite_images and convert_jpeg_to_webp the issue is fixed and I get 100/100 PSI http://prntscr.com/j36uha
But when these 2 modules are activated, the problem comes back and PSI drops 82/100 http://prntscr.com/j36zpn
Still don't understand why PSI is flagging the .jpg images from /media/ .. but when I check the page's source code there are no .jpg, just webp optimized by mod_pagespeed

Longinos

unread,
Apr 10, 2018, 6:59:59 AM4/10/18
to mod-pagespeed-discuss
I have tested your site and don´t see any error. All the css and js files are rewrited by pagespeed and the images some are converted to webp and other not, I think because CF is caching an unoptimized version of the file.
Google PSI is using as user agent Chrome 41. Chrome don´t support webp format until the version 49 so pagespeed deliver jpg format for it.

Longinos

unread,
Apr 10, 2018, 7:13:57 AM4/10/18
to mod-pagespeed-discuss
P.S.
Version 1.13.35.2 of pagespeed solved for my the issue that for some resources I am getting a s-maxage=10 for ever

Joshua Marantz

unread,
Apr 10, 2018, 9:45:00 AM4/10/18
to mod-pagespeed-discuss
TL;DR: don't use PSI to determine whether MPS is working.  Use Chrome Dev Tools or webpagetest, because (a) too much caching (b) no user-agent control.

mod_pagespeed's webp transcoding only happens when there is an Accept:image/webp request header, which Pagespeed Insights unfortunately does not send.  So when mod_pagespeed sees the request from PSI it will optimize jpegs to progressive jpegs if there isn't already a fresh version in the server-side cache.  So if you are interactively using Chrome, you can visit your site and see the webp version, but those can't be sent to PSI. So mod_pagespeed will deliver the unoptimized view, while it re-optimizes the images in the background.  During this optimization process, mod_pagespeed sends short cache lifetimes so that proxy caches won't deliver the unoptimized view forever.

WIth PSI, the usability is confounded by a server-side results-cache in PSI, which may capture the unoptimized view from mod_pagespeed.  So you have to hit PSI a few times to let its results-cache expire, while hopefully mod_pagespeed's cache doesn't.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

Otto van der Schaaf

unread,
Apr 10, 2018, 10:20:53 AM4/10/18
to mod-pagesp...@googlegroups.com
I feel that this answer would be a great candidate for inclusion in the FAQ :)


Reply all
Reply to author
Forward
0 new messages