What are agents, gateways, and tunnels?

1 Overview

In HTTP communication, in addition to the client and server, there are also some applications used for communication data forwarding, such as proxy, gateway, and tunnel. They can work with servers.
These applications and servers can forward the request to the next server on the communication line, and can receive the response sent from that server and forward it to the client.

  1. Proxy
    Proxy is an application with forwarding function. It plays the role of the "middleman" between the server and the client. It receives the request sent by the client and forwards it to the server. It also receives the response returned by the server and forwards it to the client. .
  2. Gateway A
    gateway is a server that forwards communication data from other servers. When receiving a request from a client, it processes the request like the source server that owns the resources. Sometimes the client may not be aware that its communication target is a gateway.
  3. Tunnel A
    tunnel is an application that transfers between a client and a server that are far apart and maintains a communication connection between the two parties.
2. Agency

The basic behavior of the proxy server is to receive the request sent by the client and forward it to other servers. The proxy does not change the request URI, and sends it directly to the target server holding the resource in front.
The server holding the resource entity is called the origin server. The response returned from the source server is passed to the client after passing through the proxy server.
Insert picture description here
In the HTTP communication process, multiple proxy servers can be cascaded. The forwarding of requests and responses will go through several proxy servers connected like chains. When forwarding, the Via header field needs to be added to mark the passing host information.

3. Gateway

The working mechanism of the gateway is very similar to the proxy. The gateway can enable the server on the communication line to provide non-HTTP protocol services.
Using the gateway can improve the security of communication, because the communication line between the client and the gateway can be encrypted to ensure the security of the connection. For example, the gateway can connect to the database and use SQL statements to query data. In addition, when performing credit card settlement on a Web shopping site, the gateway can be linked with the credit card settlement system.
Insert picture description here

4. Tunnel

The tunnel can establish a communication line with other servers as required, and then use SSL and other encryption methods to communicate. The purpose of the tunnel is to ensure that the client can communicate securely with the server. The tunnel itself does not parse HTTP requests. In other words, the request is forwarded to the subsequent server as it is. The tunnel ends when the communicating parties disconnect.
Insert picture description here
The blog post is borrowed from "Illustrated HTTP", thanks to the author

Guess you like

Origin blog.csdn.net/qq_41800366/article/details/106332555