【问题标题】:Facebook debug returns 403 ForbiddenFacebook 调试返回 403 Forbidden
【发布时间】:2011-12-13 18:13:01
【问题描述】:

我正在尝试通过Facebook's Debugger 运行我的 URL,以查看我是否设置了正确的元标记,以及查看这些东西是否正常工作。

当我输入我的 URL 时,我会得到一个 403 Forbidden 作为回报。

该 URL 指向一个子域,并且该域本身也返回 403 Forbidden

阅读另一篇帖子Facebook links to my site resolve as 403 forbidden,我认为我的主机可能已经设置了一个块或其他东西,但是,我似乎无法从我的计算机重新创建块。

我一直试图欺骗引荐来源网址和用户代理,但没有运气。在给房东打电话之前,我可能错过了什么?

如果相关的 URL 是:http://distorpia.dadiugames.dk/

【问题讨论】:

  • 先尝试您的主机以排除这种可能性。
  • 我只是想在我打电话给他们时告诉他们一些事情,所以他们没有给我一个空洞的答案。
  • 我知道,但是当问题可能是他们的设置或故障时,您可能会花费数小时尝试调试问题。用 5 分钟的电话与他们核对可以节省您浪费数小时的心痛!

标签: facebook http-status-code-403


【解决方案1】:

我用来测试这个问题的命令是curl -i -H 'Accept: */*' -H 'Range: bytes=0-40960' -H 'Connection: close' -A 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)' http://whatever.com - 这包括一些由 Facebook 爬虫发送的、某些主机存在问题的标头

看起来您的托管设置无法正确处理其中一个/一些标头 - 我复制了 403 错误:

对于您的 URL,返回:

HTTP/1.1 403 Forbidden
Date: Tue, 13 Dec 2011 20:54:07 GMT
Server: Apache/2.2.6 mod_auth_kerb/5.3 PHP/5.2.17 mod_fcgid/2.3.6
Accept-Ranges: bytes
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Parallels H-Sphere</title>

{{REMOVED THIS PART}}

    <h2>Error 403: Forbidden</h2>

<p>You don't have permissions to access this page.
This usually means one of the following:</p>
<ul>
<li>this file and directory permissions make them unavailable from the Internet.</li>
<li>.htaccess contains instructions that prevent public access to this file or directory.</li>
</ul>
<p>Please check file and directory permissions and .htaccess configuration if you are able to do this.
Otherwise, request your webmaster to grant you access.</p>

【讨论】:

  • 谢谢。它适用于所有上述标题,但“范围”标题。您确定 Facebook 发送“范围:字节 = 0-40960”而不是“内容范围:字节 = 0-40960”吗?这行得通。早上我会打电话给我的主人解释一下。我多么希望我能够访问日志:)
  • 根据之前的测试,我几乎可以肯定它是'Range',我会看看我是否可以从爬虫代码中得到明确的答案
  • 是的,绝对是'Range','bytes=0-40960' - 检查爬虫本身的代码
【解决方案2】:

Facebook 和 Facebook 调试器发送:

curl -i -H 'Accept-Encoding: deflate, gzip' -H 'Accept: */*' -H 'Range: bytes=0-524287' -H 'User-Agent: facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)' https://your.website/something

问题可能出在 owasp-modsecurity-crs 规则 #958291,它给出了误报结果:https://github.com/SpiderLabs/owasp-modsecurity-crs/issues/173

通过发送带有标题Range: bytes=524287(代替Range: bytes=0-524287)的请求来检查它:

curl -i -H 'Accept-Encoding: deflate, gzip' -H 'Accept: */*' -H 'Range: bytes=524287' -H 'User-Agent: facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)' https://your.website/something

解决方案

【讨论】:

    猜你喜欢
    • 2019-04-22
    • 2012-01-22
    • 1970-01-01
    • 1970-01-01
    • 2020-10-05
    • 2012-08-26
    • 1970-01-01
    • 2014-06-15
    • 1970-01-01
    相关资源
    最近更新 更多