Cloudfare 后面的页面禁止 OWASP ModSecurity Docker 映像访问

发布于 2025-01-15 07:04:28 字数 112 浏览 3 评论 0原文

我在反向代理模式下使用最新的 docker 镜像
我不断收到相同的消息 403 禁止,我认为原因是 ModSecurity 图像尝试使用其 ip 直接访问该站点,而不使用主机标头
我该如何解决?

I'm using the latest docker image in reverse proxy mode
I keep receiving the same message 403 forbidden, I think cause the ModSecurity image try to reach the site directly with its ip and without Host header
How can I resolve?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

穿透光 2025-01-22 07:04:28

您的问题可能与 NGiNX 设置的 Host 标头有关。如果您连接到localhost,则传输的Host标头将为localhost,并且接收服务器很可能不接受该标头。

如果这确实是您的问题,那么您可以通过显式设置 Host 标头来诊断它,并查看是否可以解决问题。例如:

curl -H "Host: real.host.name.com" localhost:8080

请注意,容器的行为符合设计。但是,可以创建一个案例来支持以下情况:对代理的所有请求都使用与代理目标匹配的 Host 标头。如果您认为需要,请在 GitHub 上打开问题:https://github .com/coreruleset/modsecurity-docker/issues/new。我们很乐意提供帮助。

Your issue is likely with the Host header that is being set by NGiNX. If you connect to localhost, the transmitted Host header will be localhost and the receiving server will most likely not accept that.

If this is indeed your issue, then you can diagnose it by setting the Host header explicitly, and see whether that solves it. For example:

curl -H "Host: real.host.name.com" localhost:8080

Note that the container behaves as designed. However, a case could be made to support a case where all requests to the proxy use the Host header that matches the proxy target. If you feel that you need that, please open an issue on GitHub: https://github.com/coreruleset/modsecurity-docker/issues/new. We'll be happy to help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文