# Onebox 在一台服务器上失败但在另一台服务器上正常的问题

**URL:** <https://meta.discourse.org/t/issue-with-onebox-failing-on-one-server-but-not-another/142295>\
**Category:** Support\
**Created:** [2020年二月21日 20:46 UTC](https://meta.discourse.org/t/issue-with-onebox-failing-on-one-server-but-not-another/142295 "2020-02-21T20:46:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [2020年二月21日 20:46 UTC](https://meta.discourse.org/t/issue-with-onebox-failing-on-one-server-but-not-another/142295/1 "2020-02-21T20:46:23Z")

</div>

各位，我一直在尝试做速卖通的联盟推广。

最近，我在使用的网站上，他们的 Onebox 开始失效了。

我深入排查后发现，在我另一台 Discourse 服务器上它是正常工作的。这两台服务器都运行相同版本的 Discourse（2.4.0.beta11），并且都使用 Scaleway 提供的 VPS，操作系统为 Ubuntu。

不过，当我在命令行中使用 curl 比较它们的请求路径时，注意到失效的服务器多了一个 302 重定向，尽管最终它们似乎都解析到了同一个 URL。

这是否会导致当前的 Onebox 代码失效？

我使用以下命令来追踪跳转（包含最终 URL）：

`curl -sLD - http://s.click.aliexpress.com/e/nzyWNlXw -o /dev/null -w '%{url_effective}'`

最近 Onebox 是否有更新，使其对这种情况更加敏感？

如果我说了一些外行的话，请见谅，因为我对这个特定领域并不专业！

---

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [2020年二月21日 21:25 UTC](https://meta.discourse.org/t/issue-with-onebox-failing-on-one-server-but-not-another/142295/2 "2020-02-21T21:25:49Z")

</div>

好的，这越来越奇怪了，但也更接近我怀疑的原因：

如果我使用 Curl 获取最终 URL 并将其输入到本地浏览器中，来自故障服务器的 URL 会引导我进入登录提示，而来自正常工作的服务器的 URL 则不会。

…

---

<div class="post-metadata">

**Author:** ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)\
**Post date:** [2020年二月22日 00:54 UTC](https://meta.discourse.org/t/issue-with-onebox-failing-on-one-server-but-not-another/142295/3 "2020-02-22T00:54:18Z")

</div>

在一种情况下，一个资源位于启用了防盗链保护的 CDN 上，而另一个则没有。

---

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [2020年二月22日 00:58 UTC](https://meta.discourse.org/t/issue-with-onebox-failing-on-one-server-but-not-another/142295/4 "2020-02-22T00:58:33Z")

</div>

嘿，Stephen，两种情况下的链接是一样的。我觉得目标服务器可能只是不信任其中某一台服务器？

---

<div class="post-metadata">

**Author:** ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)\
**Post date:** [2020年二月22日 02:58 UTC](https://meta.discourse.org/t/issue-with-onebox-failing-on-one-server-but-not-another/142295/5 "2020-02-22T02:58:16Z")

</div>

不一定。即使两个源服务器位于同一数据中心，并通过 CDN 访问同一个负载均衡器，它们也不一定连接到同一台后端机器。

---

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [2020年二月22日 07:32 UTC](https://meta.discourse.org/t/issue-with-onebox-failing-on-one-server-but-not-another/142295/6 "2020-02-22T07:32:52Z")

</div>

说得对。但这仍然会导致同样可重复的、令人沮丧的糟糕结果。

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2024年一月27日 01:09 UTC](https://meta.discourse.org/t/issue-with-onebox-failing-on-one-server-but-not-another/142295/7 "2024-01-27T01:09:57Z")

</div>


