Difference between proxying and routing
I'm well aware what proxies and routers are used for. But I don't know how to reliably differentiate them.
Here is a list of factors that I find in them.
Proxy server
- Can freely modify application layer data
- Usually receives a TCP session from origin
- Usually forms a TCP session to target
- May read application layer data to define target
- Is target of an IP packet when using the IP protocol
Let's rather not think about a piece of network equipment here. Think about a mesh of application servers that route SOAP requests. Router
- Conforms to well-defined routing protocols
- Usually receives a TCP session from origin
- Usually forms a TCP session to target
- May read application layer data to define target
- Is target of an IP packet when using the IP protocol
Is it called routing when rules of routing are known to all parties and proxying when not? I do believe there is a definitive factor to differentiate the two.
Solution 1:
A proxy server and a router act at different levels in the protocol stack. A proxy acts at the application layer (e.g. an HTTP proxy). A router acts at the internetwork layer (e.g. IP protocol).
The primary job of a router is to move packets between networks.
The primary job of a proxy is to perform some useful service such as caching HTTP content, applying application-level filtering and authorization functions and so on.
Routers are usually not concerned with establishing TCP sessions. Even a router performing Network Address Translation (NAT) just keeps track of sessions between internal clients and external servers and amends IP-addresses as needed.
In normal use, routers are not the end-points of TCP sessions.
In normal use, routers do not read the contents of application-layer protocols.
Solution 2:
In the OSI model, routing is generally restricted to layer 3, the network layer. Routers will be primarily shuffling IP packets between networks (not really being too concerned with TCP streams unless QoS is in play). Routers cause the IP header to be changed on packets as it traverses between networks, but usually don't modify the payload of the packets.
Proxies generally work on layer 4 (transport) and above (layer 7, the application layer, being most common). Proxies likely work on a data unit greater than a single packet, and are more likely to do things like add to modify the payload of data (HTTP proxies adding Via:
headers a good example).
As with most of anything in networking, the borders between the layers can and sometimes are blurred. Routers can perform many functions of proxies, such as modifying traffic, filtering for security, etc. and proxies can be used to enable two disparate networks to talk to each other. It usually makes the most sense for a router to do as little as possible for performance and cost reasons, since typically needs to reliably handle ALL Internet traffic for an entire network, not just specific application traffic.
Solution 3:
I think I figured the defining factor.
Proxy server forces target to reply to back to itself. Proxy server can then relay the response to the origin, synchronously or asynchronously. Forcing the reply through itself defines the proxy server.
Proxy can also be a cluster. In this case the reply is forced through a single proxy cluster instead of a single proxy server.