来自外部和内部 IP 的 Http 请求

发布于 2024-12-07 13:35:54 字数 314 浏览 0 评论 0原文

我有带有互联网域名的网络服务器。该服务器有 2 个 IP:内部外部。 我的 Web 应用程序接收来自 Internet(外部 IP)的 HTTP 请求。如果该 Web 应用程序向 Intranet 网络内的其他 Web 服务器发出 HTTP 请求,但该服务器也有 2 个 IP(外部和内部),那么第一个服务器将使用哪个 IP? 如果我通过外部 IP 收到来自 Internet 的请求,如何将 IP 更改为内部 IP 以便向 Intranet 内的其他服务器发出 HTTP 请求?

I have web server with Internet domain name. That server has 2 IP: Internal and External.
My web application receives HTTP requests from Internet (external IP). If that web app makes HTTP request to other web server inside our Intranet network, but which also has 2 IP (external and internal), which IP will be used by first server?
And if I receive request from Internet at external IP how can I change IP to internal for doing HTTP requests to other server inside Intranet?

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

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

发布评论

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

评论(1

情域 2024-12-14 13:35:54

这将取决于您的环境。例如,

  1. 您是否使用相同的主机标头(例如 www.mysite.com)从内部和外部网络访问第二个 Web 服务器?如果否,则在访问 Web 服务器时使用内部主机标头。

  2. 如果它的主机头相同,它会解析到哪个 IP?您可以进行 DNS 配置,以便从内部站点访问时,相同的主机地址将解析为内部 IP。

  3. 您始终可以使用基于 IP 的寻址 - 您必须确保在 2 个 Web 服务器上,如果主机标头是 IP 地址,则它应该映射到网站。我不会推荐这种方法,因为它很脆弱,并且依赖于将 IP 地址绑定到特定站点。

  4. 最后,您始终可以使用第一个 Web 服务器上的本地主机文件在配置的主机标头下注册第二个 Web 服务器的内部 IP 地址。然后,在第一个 Web 服务器上使用该主机标头的请求将始终使用内部 IP。

This will depend on your environment. For example,

  1. Are you using the same host header (e.g. www.mysite.com) for accessing the second web server from internal and external network? If no then use the internal host header while accessing the web server.

  2. If its same host header, to which IP it get resolved? You can have DNS configuration that so that the same host address will be resolved to internal IP if accessed from the internal site.

  3. You can always use IP based addressing - you have make sure that on 2 web server that if host header is IP address then it should get mapped to the web site. I would not recommend this approach because it brittle and depends upon binding the ip address to particular site.

  4. Finally, you can always use local hosts file on the first web server to register the second web server internal IP address under configured host header. Then requests using that host header on first web server will always use internal IP.

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