How To Fix – Amazon s3 URL Getting Blocked By Facebook

Update: the cause of this problem wasn’t as a result of the presence of s3 url but because my blog domain name got blocked by facebook as at the time.

Few months ago, I started using Amazon s3 to host and serve my blog images. My transition wasn’t that smooth as I have had fix few problems regarding Amazon s3. firstly was setting cache to increase site performance and reduce bills, and then finding a tool to carry out basic s3 operations.
Everything was going fine until suddenly, I discovered that, I wasn’t able to share my blog post on Facebook. More so, the Facebook- like social plugin on my blog wasn’t functioning. The cause of this problem was as a result of image URL pointing to my Amazon s3 bucket getting blocked by Facebook.

Below is a screenshot of the error message I often get while trying to share a post on Facebook. Facebook blocking Amazon s3 image

But when I opted to host the image on my web server i.e. the image URL is now pointing to my domain name. The problem won’t arise.

How I fixed it

I knew I had to find a way to rewrite the Amazon s3 image URL. I thought of using Amazon cloudfront or Maxcdn to rewrite and serve the images, I wasn’t yet prepared to pay for any CDN so I had to look for a free alternative. while in search of a free cdn, I quickly remembered Jetpack Photon by WordPress. since I already have jetpack plugin installed, it was a matter of me activating Photon module.

With the activation of Photon, all image urls are now re-written and served dynamically from the global WordPress.com cloud. the image urls are now prefixed with http://i0.wp.com. E.g. http://i0.wp.com/w3guy.com.s3.amazonaws.com/wp-content/uploads/2013/10/disposableEmail.jpg

Summary

In this article, I showed us how I rewrote Amazon s3 URL and served it dynamically from the global WordPress.com cloud. Now my Facebook like button is working fine and I can also share my blog link on Facebook without facebook blocking image link point to Amazon s3.

Don’t miss out!
Subscribe to My Newsletter
Invalid email address