Spring Boot中如何获取客户端的私有IP地址?

发布于 2025-01-10 17:11:52 字数 255 浏览 2 评论 0原文

我想知道与我的 Spring Boot 应用程序交互的客户端的私有 IP 地址。这些客户端也是 Spring Boot 应用程序。其中一些在代理后面运行。(对于这些客户端,我尝试获取 x-forwarded-for 标头)。我尝试从 httpservletrequest 获取它们的 IP 地址,但我只能获取它们的公共 IP。 (就像其中一个客户端应用程序在192.12.34.5服务器上运行一样。但我的应用程序只能获取公共IP,如152.12.3.56。)有什么方法可以获取客户端的私有IP吗?

I want to know the private ip address of client who are interacting with my spring boot application. These clients are also the spring boot applications. Some of them are running behind proxy.(for these clients I tried to get x-forwarded-for headers). I have tried to get ip address of them from the httpservletrequest but I am only able to get their public ip. (like one of client application is running on 192.12.34.5 server. But my application only able to get public ip like-152.12.3.56.) Is there any way to get private ip of client?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文