Symptoms
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:
/etc/apache2/logs/error_log
[Thu Mar 11 21:43:12.750371 2021] [pagespeed:warn] [pid 28240:tid 47892692387584] [mod_pagespeed 1.13.35.2-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 1.13.35.2-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 1.13.35.2-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 1.13.35.2-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:
How to diagnose and debug problems when using mod_pagespeed
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:
How to edit the mod_pagespeed use agent to assist in troubleshooting the PageSpeed fetcher
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.
Description
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. The following workaround section offers some suggestions.
Workaround
PageSpeed does not fetch HTTPs URLs by default. If your website redirects HTTP requests to HTTPs, you'll need to customize the configuration to enable the HTTPs fetcher.
Open the /etc/apache2/conf.modules.d/510_pagespeed.conf file with a text editor of your choice.
Add the following to the bottom of the configuration file:
ModPagespeedFetchHttps enable
You must then restart Apache for the change to take effect with the following command:
/scripts/restartsrv_httpd
It is also possible that you continue to have this problem even after enabling the HTTPs fetcher. This could be caused by a number of various problems. Adding additional options to the configuration may workaround some problems with your site's certificate:
ModPagespeedFetchHttps enable,allow_self_signed,allow_unknown_certificate_authority,allow_certificate_not_yet_valid
This configuration is specifically explained in the official documentation here:
mod_pagespeed Docs - Fetch HTTPS resources directly
If you're unsure where the configuration file is, you can learn here:
What are the configuration file locations for mod_pagespeed on a cPanel server?
You may also want to purge the mod_pagespeed cache after updating the configuration:
Comments
0 comments
Article is closed for comments.