# 无法在禁用强制 HTTPS 的网站上启用 DiscourseID

**URL:** https://meta.discourse.org/t/cant-enable-discourseid-on-a-site-with-force-https-disabled/399376
**Category:** Self-hosting
**Tags:** discourse-id
**Created:** [2026年三月26日 20:29 UTC](https://meta.discourse.org/t/cant-enable-discourseid-on-a-site-with-force-https-disabled/399376 "2026-03-26T20:29:27Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)
#### Post date: [2026年三月26日 20:29 UTC](https://meta.discourse.org/t/cant-enable-discourseid-on-a-site-with-force-https-disabled/399376/1 "2026-03-26T20:29:27Z")

</div>

为了提供上下文，我的 Discourse 测试站点运行在 Proxmox 容器中，位于同一网络（但不同子网）的另一台服务器上的 Nginx（npmplus）之后。这没什么特别的。我曾尝试启用 `force-https`，但不断遇到一堆 CSRF 验证错误，因此我再次将其禁用，因为不值得为此争执。无论上述情况如何，该站点在 HTTPS 上都能正常工作，因为 Nginx 和 Cloudflare 都已正确配置：

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/6/a/d6ab7e1dd79332f279a71f7485a849b1d754b6f1.png)

我刚才尝试在该站点上启用 DiscourseID，但遇到了错误：

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/3/f/83fc018567ef53e9e0e398a091575de7027e1097.png)  
 ![image](https://global.discourse-cdn.com/meta/original/4X/9/3/2/9322fc450b2961af0eb37bbb8d92fe57ed67b7d3.png)

有没有一种变通方法，不需要花费数小时与 npmplus 对抗来解决 Discourse CSRF 验证不断报错的问题？本线程并非用于调试 npmplus 或 SSL，我只想修复 Discourse ID。

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [2026年三月26日 20:39 UTC](https://meta.discourse.org/t/cant-enable-discourseid-on-a-site-with-force-https-disabled/399376/2 "2026-03-26T20:39:27Z")

</div>

错误消息“返回的 Discourse ID"指出，网站的 Redirect URI 必须为 https，因此您需要启用 `force_https`，或者通过代理配置表明请求是通过 https 传入的。

> [@darkpixlz](#):
>
> 该网站在 https 上运行正常

除了所有不正常的部分：

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/e/7/ae7660499e1723aef57cc0877b23ec53e248e2e7.png)

---

<div class="post-metadata">

### Author: ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)
#### Post date: [2026年三月26日 20:45 UTC](https://meta.discourse.org/t/cant-enable-discourseid-on-a-site-with-force-https-disabled/399376/3 "2026-03-26T20:45:52Z")

</div>

> [@supermathie](#):
>
> 除了所有不匹配的情况：
> 
> ![image](https://global.discourse-cdn.com/meta/original/4X/a/e/7/ae7660499e1723aef57cc0877b23ec53e248e2e7.png)

嗯，我猜我从未注意到这些。正如我所说，我尝试启用了 `force_https`，但在执行任何操作时一直收到 CSRF 错误。也许普通的 nginx 变量在 npmplus 上根本不起作用（根据上方说明所示），因为我当时使用的配置如下：

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/9/0/89040dd96c46a504e927c012785405791be030d2.png)

除此之外，我的 CT 上的 443 端口没有响应，因此它仍然通过 80 端口在本地连接。

---

<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: [2026年三月26日 21:44 UTC](https://meta.discourse.org/t/cant-enable-discourseid-on-a-site-with-force-https-disabled/399376/4 "2026-03-26T21:44:23Z")

</div>

您应该修复反向代理设置，并确保 HTTPS 正常运行。

---

<div class="post-metadata">

### Author: ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)
#### Post date: [2026年三月26日 22:15 UTC](https://meta.discourse.org/t/cant-enable-discourseid-on-a-site-with-force-https-disabled/399376/5 "2026-03-26T22:15:56Z")

</div>

我认为目前的问题只是 npmplus 暴露的变量有些异常。我之前有一个可用的配置，但弄丢了，现在不太确定该怎么办。我暂时采用了以下方案，但在 100% 确定它能正常工作之前，我不想启用该设置，以避免出现 `BAD CSRF` 错误，并再次前往 Rails 控制台进行修复。

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/a/f/caf5793011d0b00b95b553ff8e3aac87665daadc.png)  
 ![image](https://global.discourse-cdn.com/meta/original/4X/e/4/2/e422db72c76d22c398b134d2e2c26039c4824381.png)  
 ![image](https://global.discourse-cdn.com/meta/original/4X/6/a/2/6a2b441d4b38dea5907da79da78521495466fda5.png)

有趣的是，它似乎只是拒绝通过 443 端口的流量，我认为这并不正常，尽管目前代理已设置为 80 端口。

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/a/0/da07f72c430cb43af885301e647f536c8a1389ed.jpeg)

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [2026年三月26日 23:33 UTC](https://meta.discourse.org/t/cant-enable-discourseid-on-a-site-with-force-https-disabled/399376/6 "2026-03-26T23:33:10Z")

</div>

> [@darkpixlz](#):
>
> 看起来只是拒绝了超过 443 的流量

无法解引用此指针——我想您说的是 Discourse 容器？

`force_https` 不会影响 Discourse 是否在 443 端口（HTTPS）提供服务；它仅告知 Discourse 应假设其始终通过 https 进行访问。

---

<div class="post-metadata">

### Author: ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)
#### Post date: [2026年四月20日 19:18 UTC](https://meta.discourse.org/t/cant-enable-discourseid-on-a-site-with-force-https-disabled/399376/7 "2026-04-20T19:18:26Z")

</div>

我会回来这里，为其他受此影响且找不到明确答案（就像我之前一样）的人提供帮助：问题在于我没有在 app.yml 中使用 `cloudflare.template.yml` 文件。😭

---

<div class="post-metadata">

### Author: ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)
#### Post date: [2026年五月20日 19:18 UTC](https://meta.discourse.org/t/cant-enable-discourseid-on-a-site-with-force-https-disabled/399376/8 "2026-05-20T19:18:29Z")

</div>

此话题已在最后回复后 30 天自动关闭。不再允许新回复。
