反向代理 Error 429 问题

Hi, My Discourse is run with reverse proxy (NPM)

the discourse don’t it does not support the x-forwarded field and therefore shows me all the time the ip address of my reverse proxy when we look for example from which ip the user is registering etc …

I sniff the request on discourse and the X-forwarder is present but in access.log the IP view is the reverse proxy

I view on interne il necessary to change the configuration template or de configuration file nginx for Discourse (not nginx on NPM)

do you help me for this ? because the discourse activate de tempalte web.ratelimite and send most error 429

:frowning:
Thank you for you help

See How to set up Discourse on a server with existing Apache sites - sysadmin - Discourse Meta for an example of how to conduits) configure the internal nginx for your reverse proxy ip.

1 个赞

我也遇到了这个问题。

我有一个 Debian 服务器,上面运行着 Apache 2.4 vHosts,其中一个 vHost 是 Discourse Docker 容器。Apache 上启用了 mod_remoteip(没有 mod_extract_forwarded),但没有任何配置选项。vHost 配置非常简单:

RequestHeader set X-Forwarded-Proto "https"
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /.well-known !
ProxyPass / http://localhost:8083/
ProxyPassReverse / http://localhost:8083/

8083 是 Discourse Docker 容器暴露的 http 端口。

基本上就是这样。

我在使用 Apache access.log 创建的统计信息中看到了不同的访问者(按 IP),更重要的是,我还看到了用户的不同最后 IP(这对我来说是一个简单的检查)。所以看起来访问者的 IP 地址通过 Apache 代理暴露给了 Discourse。在我几天前启用 mod_remoteip 之前就已经这样了。

无论如何,我现在又遇到了麻烦。一个来自波兰克拉科夫的 IPv4 地址的爬虫或 DoS 攻击正在我们的服务器上运行。它正在产生大量的 429 错误。这对我来说没问题,但所有其他访问者也收到了这些错误。

这也是这样吗?所以当连接数达到限制时,每个人都会收到错误?还是按 IP?

我的配置中是否缺少什么,或者我可以改进/调整它吗?几周前和几天前我们都遇到了 Claudebot 的问题,所以也许需要稍微提高一下限制。

谢谢,祝好,
Roi

您是否添加了用于查看远程 IP 地址是否到达 Discourse 的内容,还是所有用户似乎都来自代理?

搜索 x-forwarded-for

嗯…… :see_no_evil: 我忘了 Nginx (Discourse) 部分。 :see_no_evil: 谢谢! :slight_smile:

我刚刚编辑了 app.yml 并重新构建了容器。容器重新启动后,机器人几乎立即就回来了。我还没有看到任何 429 错误。希望“普通”用户也能保持这样。

这就是问题所在……当我查看用户的管理页面时,我总是看到不同的“最后 IP”条目。所以不知何故,Discourse 即使没有 mod_remoteip 也没有 Nginx 配置更改,也看到了用户的真实 IP。:man_shrugging:

无论如何,我很想看看 Nginx 配置更改是否能解决这个问题!:slight_smile:

1 个赞