Intermittently after enabling mod_pagespeed you may find that images and other resources on your website go missing, are broken, and show 404 errors.
You may find warnings similar to the following within the Apache error log. Note that these 4 errors are slightly different, but are caused by the same issue:
[Thu Mar 11 21:43:12.750371 2021] [pagespeed:warn] [pid 28240:tid 47892692387584] [mod_pagespeed 22.214.171.124-0 @28240] https://exampledomain.tld//xfilename.jpg.pagespeed.ic.vwPdVLxCzq.webp resource_404_count: not found (404)
[Thu Mar 11 21:43:12.751185 2021] [pagespeed:warn] [pid 28240:tid 47892698691328] [mod_pagespeed 126.96.36.199-0 @28240] Fetch failed for https://exampledomain.tld/filename.jpg.pagespeed.ic.B2rCBEDGj1.webp, status=404
[Thu Mar 11 21:43:12.752867 2021] [pagespeed:warn] [pid 28240:tid 47892830193408] [mod_pagespeed 188.8.131.52-0 @28240] filename.jpg:0: Resource based on https://exampledomain.tld/filename.jpg but cannot access the original
[Thu Mar 11 21:43:12.752922 2021] [pagespeed:warn] [pid 28240:tid 47892830193408] [mod_pagespeed 184.108.40.206-0 @28240] [0311/214312:WARNING:resource_fetch.cc(195)] Fetch failed for resource url https://exampledomain.tld/filename.jpg.pagespeed.ic.ZYQLHswKUe.webp
You may also find messages similar to the following within the HTML of your site if you turn on debug output for mod_pagespeed:
4xx status code, preventing rewriting of https://exampledomain.tld/css/example.min.css
If you'd like information about how to enable debug output in the HTML of your site please see the following resource:
You may also notice that there are no traces of the mod_pagespeed fetcher anywhere in the Apache access logs. If you'd like information about how you can search for the fetcher in the access logs, please see the following resource:
The last and potentially most important thing to note when diagnosing this particular issue is that all of the problematic URLs in the error messages above are using TLS/SSL via HTTPS, rather than HTTP.
This problem occurs because mod_pagespeed is not able to access the HTTPS urls of your site. The specific reason that the fetcher is not able to access HTTPS urls on your server can vary widely.
If you want to know the exact reason that the fetcher is not able to access HTTPS urls for your site, you'll need to work with a systems administrator to fully review the issue and provide a diagnosis for your specific situation. Although you can use the workaround below to get mod_pagespeed working even if your HTTPS urls are not working properly.
If you are not very concerned about the potential for the fetcher to cache content that may not necessarily have a valid, trusted certificate, you could add the following to the main mod_pagespeed configuration file which enables accessing HTTPS URLs no matter what state the SSL certificate is in:
This configuration is specifically explained in the official documentation here:
If you're unsure where the configuration file is, you can learn here:
You may also want to purge the mod_pagespeed cache after updating the configuration: