# 代理不再识别真实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:** 4

<div class="post-metadata">

### Author: ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)
#### Post date: [2026年七月16日 15:16 UTC](https://meta.discourse.org/t/real-ip-no-longer-recognized-through-proxy/407792/4 "2026-07-16T15:16:04Z")

</div>

照旧，发帖并查看回复能帮我找到其他类似的帖子。🤣 例如：

> [@最后显示的 IP 是反向代理 IP 地址](https://meta.discourse.org/t/last-ip-shows-reverse-proxy-ip-address/113032?u=mcdanlj):
>
> Hi, I have researched quite a lot but nothing seems to work with me. I have a discourse setup installed. And I have this remote reverse proxy server that acts as a HTTPS layer between the user and the main discourse server.. I have included these revers proxy settings properly.. But why does it still show my Reverse Proxy server’s IP Address (hostname to be specific)

谢谢大家！现在去配置容器内 nginx 的 `set_real_ip_from`！

不过我会涵盖整个 RFC1918 地址空间。供其他人参考，配置如下：

```plaintext
after_bundle_exec:
  - replace:
    filename: /etc/nginx/conf.d/discourse.conf
    from: "types {"
    to: |
      set_real_ip_from 192.168.0.0/16;
      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)._
