# 更改CDN后更新投票中的URL

**URL:** <https://meta.discourse.org/t/update-urls-inside-a-poll-after-changing-cdn/405198>\
**Category:** Support\
**Tags:** polls\
**Created:** [2026年六月12日 17:19 UTC](https://meta.discourse.org/t/update-urls-inside-a-poll-after-changing-cdn/405198 "2026-06-12T17:19:32Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2026年六月21日 02:58 UTC](https://meta.discourse.org/t/update-urls-inside-a-poll-after-changing-cdn/405198/2 "2026-06-21T02:58:20Z")

</div>

> [@Canapin](#):
>
> 重新烘焙帖子并运行 `rake 'posts:remap[cdn.unicyclist.com,unicyclist.com]'` 并没有解决问题。

我刚刚读了这个帖子，如果你还没有修复的话，我认为你可以使用内置的 `discourse remap` 功能来实现。

与 rake 任务不同，`discourse remap` 使用 `DbHelper.remap`，它会在 PostgreSQL 数据库的所有表的所有文本列中执行全局正则表达式搜索和替换。它应该能够成功找到并更新 `poll_options.html` 内部被烘焙的 CDN URL（以及 rake 任务跳过的任何其他表）。

```plaintext
cd /var/discourse
./launcher enter app

```

```plaintext
# 创建安全备份
discourse backup

```

```plaintext
# 运行全局重映射（仅域名，不带协议，以捕获所有变体）
discourse remap 'cdn.unicyclist.com' 'unicyclist.com'

```

```plaintext
# 清除 Redis 缓存（至关重要，因为 Discourse 大量缓存烘焙后的 HTML）
rake cache:clear

```

我在这里做过类似的事情（但是方向相反）：[Chat thumbnails bypass s3\_cdn\_url & use raw S3 bucket URLs - #8 by Lilly](https://meta.discourse.org/t/chat-thumbnails-bypass-s3-cdn-url-use-raw-s3-bucket-urls/404174/8?u=lilly)

---

_[View the full topic](https://meta.discourse.org/t/update-urls-inside-a-poll-after-changing-cdn/405198)._
