Http requests from external and internal IP
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开发者_JS百科 external IP how can I change IP to internal for doing HTTP
requests to other server inside Intranet?
This will depend on your environment. For example,
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.
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.
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.
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.
精彩评论