I have 2 HTTP servers running on 1 VPS. If I make a HTTP request from 1 to the other. What happens exactly? Does it go through the internet and back? Or is it handled within the VPS?

Hosting: Digital Ocean
System: Ubuntu 14.04
Server: Nginx
Web Server 1: PHP
Web Server 2: NodeJs


That depends on a few things.

The first thing your VPS does is resolve the domain name of the server it's trying to access. If you have an entry in /etc/hosts, then that DNS resolution will happen locally (and won't go out into the larger internet). Otherwise, some UDP packets will need to be sent and received.

Once that step's done, and the human-readable name has been mapped to an IP address, if that IP address maps to a local NIC then packets will be routed locally. Otherwise (if, for example, you're using a proxy) they'll be routed out of the box, where they'll travel in a loop and return right back to the VPS (assuming no one MITMs the connection).

So, assuming you have a local mapping of hostname to local IP address, it shouldn't create external internet traffic.

However, I'm guessing there are ways to ensure even local IPs are routed externally using the RPDB / netfilter.

In any case, the overwhelmingly easiest way to check things like this? Use tcpdump and analyze the output with wireshark.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.