Scenario 1
I have two applications A and B running on same server. Server is on an Intranet behind a firewall. Application A exchanges data with Application B using HTTP protocol. Will Internet be used to exchange data between A and B ? If no why ?
Scenario 2
I have two applications A and B running on different servers. Servers are in same Intranet behind a firewall. Application A exchanges data with Application B using HTTP protocol. Will Internet be used to exchange data between A and B ? If yes why ?
In the first scenario most probably it won't be. The OS will be smart enough to figure out the applications are running on the same machine and will use the local routing so that the IP packets won't even leave the local stack.
In scenario 2 it depends on the network configuration and the routing tables. It is possible that the internet won't be used, but if you have multiple routers and some specific routing configured it is possible that it will be used.