# 无法为 URL 生成预览

**URL:** https://meta.discourse.org/t/unable-to-generate-preview-for-urls/175758
**Category:** Support
**Created:** [2021年一月11日 11:36 UTC](https://meta.discourse.org/t/unable-to-generate-preview-for-urls/175758 "2021-01-11T11:36:22Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![seeminglee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/seeminglee/32/199310_2.png) [@seeminglee](https://meta.discourse.org/u/seeminglee)
#### Post date: [2021年一月11日 11:36 UTC](https://meta.discourse.org/t/unable-to-generate-preview-for-urls/175758/1 "2021-01-11T11:36:22Z")

</div>

我们的 Discourse 无法为我们的域名生成预览，尽管我已确保 OpenGraph 标签有效，并且正如本论坛其他帖子所建议的，它们确实在 iframely 中显示出来了。

URL：

[https://royaleapi.com/player/QVPJRV](https://royaleapi.com/player/QVPJRV)

iframely：

> **[Iframely URL Debugger - Open Graph, Twitter Cards, oEmbed](https://debug.iframely.com/?uri=https%3A%2F%2Froyaleapi.com%2Fplayer%2FQVPJRV)**
>
> Check your URL against Open Graph, Twitter Cards, oEmbed specs. See what other apps see.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2021年一月11日 16:02 UTC](https://meta.discourse.org/t/unable-to-generate-preview-for-urls/175758/2 "2021-01-11T16:02:56Z")

</div>

您的网站对 `HEAD` 请求返回了 HTTP 503 错误。您必须修复此问题。

```plaintext
➜ ~ curl https://royaleapi.com/player/QVPJRV -I
HTTP/2 503 
date: Mon, 11 Jan 2021 16:02:46 GMT
content-type: text/html; charset=utf-8
set-cookie: __cfduid=da03fb9dd5542a32b6480f771b47625421610380966; expires=Wed, 10-Feb-21 16:02:46 GMT; path=/; domain=.royaleapi.com; HttpOnly; SameSite=Lax; Secure
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
referrer-policy: same-origin
content-security-policy: frame-ancestors 'self' royaleapi.com royaleapi.com:* cdn.royaleapi.com *.royaleapi.com:* openfam.com fam.gg http://*.royaleapi.com:* http://royaleapi.com:* https://*.royaleapi.com:* https://royaleapi.com:*;
cf-cache-status: DYNAMIC
cf-request-id: 0793c892310000f86b2b1d8000000001
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report?s=UcIDjxpg0nJjooYIS92dS6xIvO7MzxWAjbcOCb2jq%2Fa4hyqavfjNdE2eloPIyWmWzjxJl1rJJX%2BU4ADREdpehv01nWVT2mtvg9fyV%2FlVaVoXtXKAg2D%2Fl2hd"}],"group":"cf-nel","max_age":604800}
nel: {"report_to":"cf-nel","max_age":604800}
server: cloudflare
cf-ray: 60ffdd30485cf86b-GIG

```

---

<div class="post-metadata">

### Author: ![seeminglee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/seeminglee/32/199310_2.png) [@seeminglee](https://meta.discourse.org/u/seeminglee)
#### Post date: [2021年一月11日 17:08 UTC](https://meta.discourse.org/t/unable-to-generate-preview-for-urls/175758/3 "2021-01-11T17:08:30Z")

</div>

我明白了。是的，我已禁用了该站点的 HEAD 请求。我会尝试重新启用它——不过我不确定为什么预览功能需要 HEAD 请求才能运行？

---

<div class="post-metadata">

### Author: ![seeminglee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/seeminglee/32/199310_2.png) [@seeminglee](https://meta.discourse.org/u/seeminglee)
#### Post date: [2021年一月13日 23:52 UTC](https://meta.discourse.org/t/unable-to-generate-preview-for-urls/175758/4 "2021-01-13T23:52:28Z")

</div>

@Falco 我已修复该问题，现在预览可以正常显示了。

不过，之前被判定为“无法预览”的内容似乎不再显示。看起来 Discourse 将之前无法通过 HEAD 请求获取的 URL 以某种形式缓存了起来（这只是我的猜测）。我该怎么做才能清除这些数据，并让它重新尝试获取所有 URL 的预览？

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2021年一月14日 00:08 UTC](https://meta.discourse.org/t/unable-to-generate-preview-for-urls/175758/5 "2021-01-14T00:08:04Z")

</div>

我刚刚重新生成了主贴（OP）中的帖子，这就足够了。

因此，[重新生成匹配特定模式的所有帖子](https://meta.discourse.org/t/rebake-all-posts-matching-a-pattern/48713) 应该能帮到你。
