mod_pagespeed shows in the html debug that it does not cache any pictures because of
<!--Uncacheable content, preventing rewriting of https://www.example.com/foo.png-->
The header of all pictures has a Cache-Control: max-age=31536000, public
, so that should be okay.
The page is on https, I can not set any vhost options, only .htaccess, so LoadFromFile is not an option for me. I use Apache 2.4.38 on Debian 10.
By default, ModPagespeedFetchHttps should be enabled.
EDIT: Here is a real life example:
https://www.retroplace.com/en/games?PageSpeedFilters=+debug
As you can see, none of the pictures is rewritten. As it is many pictures, resizing would significantly decrease loading time. But I can not get this to work.
2
Answers
Do you allowed your domain?
Doc: https://www.modpagespeed.com/doc/domains
Pagespeed is using an http(s) fetcher internally, it might be that it is not able to connect to the server locally. This can happen for several reasons (firewall, DNS, apache listening on an address which cannot be reached from the server)
Try getting the resource from the command-line at your server, if you can’t reach the resource mod_pagespeed won’t be able to either.
A solution for this could be to add a localhost reference to the /etc/hosts file
If all else fails mod_pagespeed also has a loadfromfile functionality, which can read resources directly from disk: https://www.modpagespeed.com/doc/domains#ModPagespeedLoadFromFile