Fixing "Fetching image failed" error
When creating a post, Google will try to directly download the post image from your website. If it is unable to do that for whatever reason, the plugin will show a Fetching image failed
error.
Usually this is because of a firewall (e.g. Cloudflare) or Image hotlinking protection is preventing Google from accessing the image.
Verifying the issue
The error will contain the URL of the image that Google has failed to download. First try opening the image URL yourself in your browser. If the image won't load in your browser, Google won't be able to load it either, causing the post to fail.
Alternatively you can use a service like httpstatus.io to confirm the actual response from your website. The http status should be 200
and nothing else. It will likely be 403
if a firewall or image hotlinking protection is blocking it:
Typical request data
Google uses the following data when making the request to download the image:
HTTP User-agent: Google-Gmb-Api
Reverse DNS hostname (wildcard): google-proxy-*.google.com
Reverse DNS hostname (typical): google-proxy-74-125-212-163.google.com
The values above can be used to set up a firewall rule to allow Google to fetch the images from your site.
Setting up a firewall rule (Cloudflare)
- Go to Cloudflare Dashboard.
- Select your domain.
- Navigate to
Security
→WAF (Web Application Firewall)
. - Click "Create Rule"
Use the following condition:
(http.user_agent contains "Google-Gmb-Api")
- Set the action to "Allow"
- Save and deploy the rule
Verifying the fix
After setting up a firewall rule, we can use the httpstatus.io service and set the User-agent to Google-Gmb-Api
to mimic Google trying to download the image from your site. Below the "Check Status" button, click setting and make the following settings:
Then enter the URL of the image into the URLs field and hit "Check Status". The Status code should be
200
, indicating the image was successfully loaded.