Home > Article > Web Front-end > What is the use of node agent?
In node, the proxy is used to obtain content from the original server. The client sends a request to the proxy and specifies the target, which is the original server. Then the proxy forwards the request to the original server and returns the obtained content to client.
The operating environment of this article: Windows 10 system, nodejs version 12.19.0, Dell G3 computer.
Forward agent
Forward agent, which is the legendary agent, works like a Springboard, to put it simply, I am a user and I cannot access a certain website, but I can access a proxy server. This proxy server can access the website that I cannot access. So I first connected to the proxy server and told him that I needed to The content proxy server that cannot access the website goes to get it back and then returns it to me.
From the perspective of the website, there is only one record when the proxy server comes to retrieve the content. Sometimes it is not known to be the user's request, and the user's information is also hidden. This depends on whether the proxy tells the website or not.
The conclusion is that a forward proxy is a server between the client and the origin server. In order to obtain content from the origin server, the client sends a request to the proxy and specifies the target (origin server). The proxy then forwards the request to the origin server and returns the obtained content to the client. The client must make some special settings to use the forward proxy.
The concept of reverse proxy
Continue with the example: a user visits http://ooxx.me/readme but the readme page does not exist on ooxx.me. He is It's normal to secretly retrieve it from another server and then spit it out to the user as your own content, but the user doesn't know it. Users are generally stupid.
The server corresponding to the domain name ooxx.me mentioned here has a reverse proxy function. The conclusion is that a reverse proxy is just the opposite. It acts like the original server to the client, and the client does not need to make any special settings. The client sends a normal request to the content in the reverse proxy's namespace (name-space), and then the reverse proxy will determine where to forward the request (original server) and return the obtained content to the client, like these The content is originally its own.
The difference between the two
In terms of use
The typical use of forward proxy is to provide a way for LAN clients within the firewall to access the Internet. Forward proxies can also use buffering features to reduce network usage. A typical use of a reverse proxy is to provide access to a server behind a firewall to Internet users. A reverse proxy can also provide load balancing for multiple servers on the backend, or buffering for slower servers on the backend. In addition, reverse proxy can also enable advanced URL policies and management technologies, so that web pages in different web server systems exist in the same URL space at the same time.
In terms of security:
The forward proxy allows the client to access any website through it and hide the client itself, so you must take security measures to ensure that only authorized clients are Provide services. Reverse proxies are transparent to the outside world, and visitors do not know that they are accessing a proxy.
Recommended learning: "nodejs video tutorial"
The above is the detailed content of What is the use of node agent?. For more information, please follow other related articles on the PHP Chinese website!