2

Someone in Facebook posted a link to my site. Facebook tries to show a preview of the page with the link but it only shows "403 Forbidden". I am sure that I am somewhere blocking this Facebook request but am not sure what the issue is. For example, I only accept GET POST and HEAD requests and perhaps this is some other kind of request.

The link looks like this (with the site name changed).

<a class="_52c6" href="https://www.example.com/index.php?topid=1&amp;grade=4&amp;page=Movement" tabindex="-1" target="_blank" data-lynx-mode="async" rel="nofollow" data-lynx-uri="https://l.facebook.com/l.php?u=https%3A%2F%2Fwww.example.com%2Findex.php%3Ftopid%3D1%26grade%3D4%26page%3DMovement&amp;h=ATMXgEds4Ymh3lFXLPXBbWVCIpDtJE_0gYVzgWTVdbsPfrBr6vIr7CJhYxkxDpQpB-js2Yl91RpOiRU5q8XFbZyvtVspSVZ6WG7tIB6rQkV2-nP8iIskWlN5Tha441w7nfGx9aaby2TmQdT9QMNt0IpGsXttslzB6GXaX7fnbgWJyHfCyJN-BdTKtO9V-gXtJc6IFiRqcSsa57JSXgNDTRq50D-dkMIl4YLFaUYN4xL8ozIOZMakcDxjgksMUx9G"></a>

Each time I load the Facebook page, I would expect to get a request in my server log that I am blocking, but I don't see any. Can you help me pinpoint what is going on here?

2
  • Facebook doesn't refresh the preview on every page load. Try sharing a new link to your site and look for requests from the user agent facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php) Oct 23, 2017 at 16:42
  • 1
    That was it. I have a long list of "bad bots" that I block access to in order to reduce traffic and this user agent was added to it. My list is kept and processed in php but if a certain threshold of hits is reached from a "bad bot" user agent, then that user agent is automatically added to a RewriteCond in .htaccess. Because it was added to .htaccess, my error log of blocked requests (generated in php) didn't contain a trace of it. It is good to know my .htaccess blocking is working.
    – mseifert
    Oct 24, 2017 at 4:08

1 Answer 1

1

The Facebook Sharing Debugger is the tool you want - you need to be logged in to Facebook to use it.

This will allow you to test a URL, and see both what Facebook has cached, and request an updated scrape:

Example response for a URL

You can also submit a list of URLs that you'd like to be invalidated from the Cache so that you can refresh a bunch of pages if required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.