# 代理不再识别真实IP

**URL:** <https://meta.discourse.org/t/real-ip-no-longer-recognized-through-proxy/407792>\
**Category:** Self-hosting\
**Created:** [2026年七月16日 13:02 UTC](https://meta.discourse.org/t/real-ip-no-longer-recognized-through-proxy/407792 "2026-07-16T13:02:29Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2026年七月16日 13:27 UTC](https://meta.discourse.org/t/real-ip-no-longer-recognized-through-proxy/407792/2 "2026-07-16T13:27:43Z")

</div>

我最近记得有关此事的一些内容，但我自己也找不到。[Handling the "chain of trust" of the end user's real IP - #8 by supermathie](https://meta.discourse.org/t/handling-the-chain-of-trust-of-the-end-users-real-ip/406372/8?u=pfaffman) 包含一个指向 Cloudflare 模板的链接，我认为这可能是一个很好的参考模型。

> <https://github.com/discourse/discourse_docker/blob/main/templates/cloudflare.template.yml>

以下是我正在做的操作，目前看来仍然有效（截至“Discourse 2026.6.0-latest - [GitHub - discourse/discourse: A platform for community discussion. Free, open, simple. · GitHub](https://github.com/discourse/discourse) 版本 5c507d8359f4d6e8a5d98780c622d51cedbd9bd7”）

```plaintext
after_bundle_exec:
  - replace:
    filename: /etc/nginx/conf.d/discourse.conf
    from: "types {"
    to: |
      set_real_ip_from 192.168.1.0/24;
      set_real_ip_from 192.168.11.0/24;
      set_real_ip_from 172.16.0.0/12;
      set_real_ip_from 10.0.0.0/8;
      real_ip_recursive on;
      real_ip_header X-Forwarded-For;
      types {

```

---

_[View the full topic](https://meta.discourse.org/t/real-ip-no-longer-recognized-through-proxy/407792)._
