# 所有插件因最近升级后的 CORS 错误而无法运行

**URL:** https://meta.discourse.org/t/all-plugins-not-functioning-due-to-cors-error-after-recent-upgrade/399466
**Category:** Self-hosting
**Tags:** cdn
**Created:** [2026年三月27日 20:35 UTC](https://meta.discourse.org/t/all-plugins-not-functioning-due-to-cors-error-after-recent-upgrade/399466 "2026-03-27T20:35:59Z")
**Posts on this page:** 1
**Showing post:** 21

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2026年四月9日 08:04 UTC](https://meta.discourse.org/t/all-plugins-not-functioning-due-to-cors-error-after-recent-upgrade/399466/21 "2026-04-09T08:04:02Z")

</div>

很高兴知道头像功能又恢复正常了！

> [@TomoftheFog](#):
>
> 据我所知，我们并没有 CDN 应用。我们尚未在 app.yml 中取消注释 DISCOURSE\_CDN\_URL。
> 
> 我们仅使用类似 DISCOURSE\_S3\_ENDPOINT 和 DISCOURSE\_S3\_CDN\_URL 等 S3 变量。

有意思，谢谢！看来我们在处理 highlightjs 捆绑包时未能正确应对这种情况，导致您的网站在使用代码块的任何主题中都会显示控制台错误。以下修复应能使其恢复正常：

> <https://github.com/discourse/discourse/pull/39175>
>
> The Rails server may provide a relative URL like \`/highlight-js/...\`. Passing th…is directly to \`import()\` will cause it to be resolved on the domain of the current script, which may be on a CDN. Also, the lookup may be blocked with an error like "The base URL is about:blank because import() is called from a CORS-cross-origin script."
> 
> This specifically affects sites which are configured with S3 assets/CDN, but no application CDN.
> 
> This commit uses the \`new URL()\` constructor to ensure that relative bundle URLs are resolved from the forum domain. URLs which already include a CDN domain will be unaffected.

这与最近的插件更改完全无关——该逻辑多年来未曾改变。不过，能够修复它总是好的。

---

_[View the full topic](https://meta.discourse.org/t/all-plugins-not-functioning-due-to-cors-error-after-recent-upgrade/399466)._
