Onebox 错误代码 403

Udemy URL 的 Onebox 预览功能出现以下错误:

“抱歉,我们无法为此网页生成预览,因为 Web 服务器返回了错误代码 403。”

不确定这是由于 Discourse 今日更新还是网站本身的问题。具体情况如下:

  1. Udemy 网站预览在前天之前一直正常。示例 URL:
    Udemy free coupon code 2021_0502-2 - udemy 優惠券 - StudyCamp 線上學習論壇

  2. 今天 Onebox 预览无法工作。示例 URL:
    Udemy free coupon code 2021_0503 - udemy 優惠券 - StudyCamp 線上學習論壇

我进行了一些进一步测试:

  1. YouTube Onebox 预览工作正常。

  2. 在 Facebook 调试工具中,Udemy 预览工作正常。
    https://developers.facebook.com/tools/debug/

用于测试的 Udemy 课程示例 URL:(奇怪的是,这里的预览工作正常)
https://www.udemy.com/course/ultimate-devsecops-with-real-world-scenarios/?couponCode=AGER4U

请提供建议。非常感谢!

Docker 镜像更新前后的对比。
PS:onebox 插件应该也是一样的

几年前发现过类似的问题。

更新信息:更新前与更新后。
附注:更新后,onebox 出现 403 错误。

https://github.com/discourse/docker_manager/compare/230dec2...93d7c8a

https://github.com/discourse/discourse/compare/54b7a0d0...f1e74c89

https://github.com/discourse/discourse-calendar/compare/082bb3d...6cc116d

https://github.com/discourse/discourse-chat-integration/compare/ec7cf1e...a1bd603

https://github.com/discourse/discourse-math/compare/c925f7e...afb8e9f

https://github.com/discourse/discourse-reactions/compare/75f9dd9...9238b8c

https://github.com/discourse/discourse-sitemap/compare/9f2e7de...e64f393

我进行了更多测试,但都没有解决这个 bug。

测试 1:恢复 bug 发生前的备份*,然后重启系统,结果出现了 502 错误。
备注:VPS 磁盘镜像备份于 4 月 27 日创建,并非 Discourse 备份的 zip 文件。

新的备份文件可以正常恢复并重启,只有旧的备份失败。这很奇怪。理论上,旧备份应该和其他备份一样正常工作。

测试 2:将 VPS 磁盘镜像备份克隆到新的 VPS,并按照以下步骤设置新域名。新站点运行正常,但该 bug 依然存在。这可能是因为重建过程加载了相同的 Discourse 镜像。

测试 3:按照以下网页中的步骤排查 403 错误原因。

下图展示了 meta 站点(上方)和我的站点(下方)在 onebox 显示上的差异。

测试了 Udemy 和 Amazon 的链接。看起来一个返回 403,另一个返回 503。
https://www.udemy.com/course/power-bi-2021-proyectos-reales-para-volverte-un-master/

< HTTP/2 403
< date: Fri, 07 May 2021 10:18:28 GMT
< content-type: text/plain; charset=UTF-8
< content-length: 16
< x-frame-options: SAMEORIGIN
< cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< expires: Thu, 01 Jan 1970 00:00:01 GMT
< set-cookie: __cfduid=dbbbf721820c12aac03e8116c362147d51620382708; expires=Sun, 06-Jun-21 10:18:28 GMT; path=/; domain=.udemy.com; HttpOnly; SameSite=Lax
< cf-request-id: 09e7ef0b3c00000b939211d000000001
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< set-cookie: __cf_bm=f83cbaa075085ed2ae624e9bcfa5badf394f7ddd-1620382708-1800-Af1qbDD41LzYLWJX0XR39JAeFnjBdEmvhZO/0YloMwnBR8urb60m7+bcte18X+L59RfHKhzWeGPELN02cuiV9RA=; path=/; expires=Fri, 07-May-21 10:48:28 GMT; domain=.udemy.com; HttpOnly; Secure; SameSite=None
< x-content-type-options: nosniff
< server: cloudflare
< cf-ray: 64b9b4585d9b0b93-NRT
<
{ [16 bytes data]
100    16  100    16    0     0    290      0 --:--:-- --:--:-- --:--:--   296
* Connection #0 to host www.udemy.com left intact

< HTTP/2 503
< server: Server
< date: Fri, 07 May 2021 10:25:04 GMT
< content-type: text/html
< strict-transport-security: max-age=47474747; includeSubDomains; preload
< x-amz-rid: P43ZS4CBG7V92Z7W4VSC
< vary: Content-Type,Accept-Encoding,X-Amzn-CDN-Cache,X-Amzn-AX-Treatment,User-Agent
< last-modified: Wed, 30 Sep 2020 23:54:00 GMT
< etag: "a6f-5b0909d09d600"
< accept-ranges: bytes
< content-length: 2671
<
{ [1139 bytes data]
100  2671  100  2671    0     0  11871      0 --:--:-- --:--:-- --:--:-- 11871
* Connection #0 to host www.amazon.com left intact