facebookfacebook-sharer

Error 403 when clicking "Share"


Error 403 for webpage snippet when clicking "Share"

This happens on some but not all pages.

For example on this page

When you click "share", it opens this in a popup

With the following error:

Facebook 403 share error

403 - Error: 403

... If you are experiencing errors... Please contact the administrator...

WWW.TENSTARS.RU

The problem disappears if I open the page in the facebook debugger:

NOTE: DO NOT open the page in the facebook debugger, it will remove the error and others will not be able to see it!

https://developers.facebook.com/tools/debug/

But the error re-appears on a different page.

I tried using the official share code but that didn't help.

I suspect that the problem is caused by the facebook crawler failing to download some page and then using a "failed" copy, but I would like to debug/figure out the actual reason.


Solution

  • I setup some Facebook bot logging

    Facebook bot tracking in /index.php
    facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
    

    Clicking the Facebook share button does not trigger the facebook bot to download the page. The webpage download (Crawl) by the Facebook bot is triggered by the JavaScript SDK, and you can't load the share windows without the SDK. The bot crawl is also triggered by publishing the URL anywhere on facebook.

    Facebook SDK

    (function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/ru_RU/all.js#xfbml=1&appId=368997699815031";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    

    Facebook downloads 2 pages with every 1 request (depends on the SDK config):

    [2014-03-13 10:34:57][facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)] /films/events/mtv-movie-awards-2014.html
    [2014-03-13 10:34:59][facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)] /films/events/mtv-movie-awards-2014.html?fb_locale=ru_RU
    

    If Facebook downloads a page with an error status, Facebook will not re-download it unless you download it with the Facebook lint debugger tool or some unknown to me timeout runs out. (unless you specify this timeout manually in og:ttl)

    In my case the facebook SDK requested the page while it was still being edited and cached the 403 response that it was giving.

    The preview/story (or whatever you call it) shows the same text and status code that your website returned when the Facebook bot downloaded the webpage.