0

I created a Coming Soon page with a "Share on Facebook" button but when it's clicked it'll open up Facebook on the "Say something about this" page but the actual content it's shows is nothing but a 403: Forbidden. When I end up sharing it anyway it still appears on my wall as the 403: Forbidden but the link as it should works though, i.e. by clicking on it on my wall it'll take me to my site just fine. Also when I go to my site normally it also works. I'm using Nginx as my server and from what I've seen 403s are quite common for Nginx and I've found multiple articles dealing with 403s but none of them talk about solving it for FB share buttons (only for when you get a 403 trying to access the site normally).

After clicking the Share button this is what the preview looks like

In my HTML I have the following meta tags in the head, the following script and the following share button:

<!-- Meta Tags: -->
<meta property="og:url" content="http://www.example.com" />
<meta property="og:type" content="website" />
<meta property="og:title" content="exampleName" />
<meta property="og:description" content="exampleSlogan" />

<!-- FB Script -->
<div id="fb-root"></div>
<script>(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 = 'https://connect.facebook.net/i/suspect/i/should/maybe/keep/this/part/secret';
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<!-- Share button -->
<div class="social-btn btn-fb" data-href="http://example.com" data-layout="button" data-mobile-iframe="false">
  <a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=example.com;src=sdkpreparse"><i class="fa fa-facebook"></i></a>
</div>

I'm sure you'll be able to tell where I censored urls, values, etc. but if you're not sure whether or not something is wrong or if it's censored, feel free to ask

As far as Nginx goes my skills are still pretty limited so I don't really know what to include here to help solve the issue so If you want me to post something Nginx related let me know and I'll do it. Also let me know if I need to supply any other information.

Edit I don't know if this is relevant to my issue but when I open the my web page it gives my js error: FB.NativeExtensions.onready only works when the page is rendered in a WebView of the native Facebook app. Test if this is the case calling FB.UA.nativeApp()

SeriousLee
  • 1,301
  • 4
  • 20
  • 42
  • Re edit: https://stackoverflow.com/q/48782951/1427878 – CBroe Feb 14 '18 at 19:06
  • Go check your server logs and find out why those requests coming from the Facebook scraper were blocked (re-scrape via FB debug tool to "create" a request) - likely due to the User-Agent, or some kind of bot detection/DoS prevention going wrong. – CBroe Feb 14 '18 at 19:08
  • I checked the `error.log` and `access.log`, nothing pops up in either of them when I hit the share button. The `access.log` does however print a couple of things when I refresh my page though none of what it prints seem to be anything FB/403/etc related. Is there any other Nginx logs that I could check? – SeriousLee Feb 14 '18 at 19:29
  • I did not say hit the share button (that does not cause a request, if Facebook has data about your page already cached), but use the debug tool. – CBroe Feb 14 '18 at 19:36
  • Ooooh, I see what you said, my bad. I did what you said (rescrape with the debug tool) and although that didn't print anything in the access log, it did somehow solve the issue. Now when I click share on my page it actually shares my stuff. Thank you, stranger! – SeriousLee Feb 14 '18 at 19:41

1 Answers1

1

To figure out what goes wrong in such a case, re-scrape the URL using the Facebook debug tool, and then check the server logs around this time.

If scraping alone solved the issue, then your server for some reason blocked the request the last time the Facebook scraper did try to gather data, but doesn't any more now. If this wasn't a one-off occurrence, but turns out to be a more systematic issue with new articles, then check if you maybe have a like button embedded in a preview of the URL that is only available to the logged-in admin, or something like that, that could trigger a scrape by Facebook before your system is willing to answer the request "properly" to outsiders.


If you need to correct this issue for more than a few URLs now, you can also trigger a re-scrape via the API.

CBroe
  • 91,630
  • 14
  • 92
  • 150