AdSense Secondary Domain

Monday, August 26, 2013

Why "Pinterest Could Not Fetch The Image"?..

It was one of biggest mysteries for me, but since Pinterest was launched and became popular, I was not able to get it working for my cooking website.

At some point I decided that it wasn't meant to be and gave up. And ever since then, I was answering something like "It doesn't work, and I don't know why :(" to every inquiry from my readers on how to pin my recipes.


How to Reproduce The Issue

This is how the issue looked to my readers. An interface to select image opens when I click on "pin" button:

There I can select an image and click "pin it" to receive an interface to describe a pin and select a board:

And then, after I click "Pin It", I am presented with "Whoops! Sorry we could not fetch the image." error:



Pinterest Uses Amazonaws.com for Fetching

I did a bit more digging and now I have an answer to the question which bothered me for couple of years: Pinterest can't fetch the image, despite the fact that it shows it to me, because I have access to my website closed to any host of amazonaws.com / Amazon Cloud origin, and Pinterest seems to use services hosted on amazonaws.com to fetch images (at least for some actions).

I did close access from amazonaws.com while back to prevent getting click bombed on my AdSense ads, tons of invalid clicks seemed to come from visits from amazonaws.com. I never understood what was causing them, but denying access for everything of amazonaws.com origin fixed the problem once and for all.

Or until I wanted to have my recipes pinnable by Pinterest...


How to Fix The Issue?

So if you have similar issue like me, I hope I can save you some time trying to figure out how to fix it, like I wish, someone did for me long ago.

Simpler solution is to allow amazonaws.com access your website (that is not a case for me, but it might still work for you).

More elegant solution is to allow only pinterest services to access your website from all the traffic coming from amazonaws.com. If you used the following .htaccess deny rule to restrict that access:

order allow,deny
deny from amazonaws.com
allow from all
Here is an example how you can correct it to allow pinterest traffic through while keeping the rest of amazonaws.com out:
SetEnvIfNoCase Remote_Host "amazonaws.com$" a_robot
SetEnvIfNoCase User-Agent "^Pinterest.*" !a_robot
order allow,deny
deny from env=a_robot
allow from all


Conclusion

Listed solution will only fix the issue with pinning pages, if the cause of it, as I said earlier, is restriction of amazonaws.com traffic access to the website via .htaccess.

Even though mine case was a tricky one to figure out, it isn't the only one out there. There maybe some other reasons why pinterest doesn't do what it is supposed to. I will appreciate if you share yours findings.

6 comments:

  1. I tried all sorts of things with no success, but this worked. Copied it to the end of my .htaccess file
    Thanks a million! :)

    ReplyDelete
  2. stupid question, but where do I post this code?

    ReplyDelete
    Replies
    1. It should go into .htaccess file in the root folder of your website.

      Delete