Forward agent

At present, There is no access to Google in China, but we sometimes say that we can access Google smoothly by hanging a proxy, and this proxy mode is forward proxy. If we have a server in Hong Kong, this server can access Google. However, we cannot directly access Google in China, but we can access the server in Hong Kong. Every time we request the Hong Kong server, after the Hong Kong server gets our request, it visits Google server, Google server returns the response to Hong Kong server, Hong Kong server returns the response to us. So we can access Google without any problems.

The most important feature of forward proxy is that the server only knows which proxy server the request comes from, but not the specific client. The forward proxy mode masks or hides the real client information.

However, if too many clients use proxy, the proxy server frequently requests Google, and Google may think that the proxy server is a crawler and will make some anti-pickling mechanism, so that the client cannot access normally. Therefore, sometimes the proxy server will tell Google that I am a proxy server.

Generally speaking, agents can be divided into three types, namely transparent agents, anonymous agents and highly anonymous agents.

  • Transparent proxy, the proxy server exposes the real information of the client.
  • Anonymous proxy that hides client information but declares itself to be a proxy server.
  • A highly anonymous proxy hides the client information and does not declare itself as a proxy server. The target server does not know whether a proxy is used, let alone the real information of the client

The reverse proxy

Taobao, for example, has a large number of visitors every day. It is impossible to handle all the business with a single server, so distributed deployment appears. This is to solve the problem of limited access by deploying multiple servers.

The client requests taobao.com, and the DNS server resolves the domain name to the Nginx server. After receiving the domain name, the Nginx server distributes it to the back-end business processing server for processing according to certain rules.

The source of the reverse request (i.e. the client) is clear, but it is not clear which server handles the request. Nginx acts as a reverse proxy.

A reverse proxy hides information about the server that processes the business.

conclusion

Forward proxy, relatively speaking, the target server does not know the client information, the request is initiated by the proxy server.

Reverse proxy: The client does not know which server processes services. For example, when we visit Taobao, we don’t care which server handles our business. We only know that we visit Taobao.com