IssueWhen sharing a post on facebook including a link to a website serving optimized content by mod_pagespeed you might experience issue including a proper website preview / featured image. Investigating the issue using the
FB developer tools might result in invalid image format or similar error message although you can view the corresponding image.
ReasonApparently the facebook bot responsible for crawling and creating an adequate website preview does not understand the optimized image format delivered by mod_pagespeed.
Workaround
I believe FB developers are working on extending the facebook bot to support webp in future. In the meantime, you can prevent mod_pagespeed to optimize images for the facebook bot by including the following code snippet (compatible with Apache 2.4) to your apache config / .htaccess. It checks for the user agent facebookexternalhit and disables selected image conversion filters of mod_pagespeed.
<IfModule pagespeed_module>
<If "%{HTTP_USER_AGENT} =~ /facebookexternalhit.*/">
ModPagespeedDisableFilters convert_jpeg_to_webp,convert_png_to_jpeg
</If>
</IfModule>
Hope this helps,
Matthieu