Home > Article > Operation and Maintenance > The difference between nginx forward proxy and reverse proxy
The forward proxy is a proxy server (intermediate server) located between the client and the target server. In order to obtain content from the original server, the client sends a request to the proxy server and specifies the target server. The proxy then forwards the request to the target server and returns the obtained content to the client. In the case of forward proxy, the client must make some special settings before it can be used.
Reverse proxy is just the opposite. To the client, the reverse proxy acts like the target server. And the client does not need to make any settings. The client sends a request to the reverse proxy, and then the reverse proxy determines where the request is going and forwards the request to the client, making the content just like itself. The client will not be aware of the services behind the reverse proxy. , so there is no need to make any settings on the client, just treat the reverse proxy server as the real server.
Difference
Forward proxy requires you to actively set the proxy server IP or domain name for access, and the set server IP or domain name will obtain the access content and return it; while reverse proxy requires you to actively set the proxy server IP or domain name for access. The proxy does not require you to make any settings. You can directly access the server's real IP or domain name, but the server will automatically jump and return content based on the access content. You don't know which machines it will ultimately access.
The forward proxy is a proxy client, sending and receiving requests for the client, making the real client invisible to the server; while the reverse proxy is a proxy server, sending and receiving requests for the server, making the real server invisible to the client. visible.
From the above description, we can also see the two most critical differences between forward proxy and reverse proxy:
Whether to specify the target server
Whether the client needs to be set up
Forward proxy and reverse proxy
In the forward proxy, the proxy and client belong to the same LAN and are transparent to the server ; In reverse proxy, proxy and server belong to the same LAN and are transparent to the client. In fact, what proxy does in both proxies is to send and receive requests and responses on its behalf, but from a structural point of view, the left and right are interchanged, so the former proxy method is called forward proxy, and the latter is called reverse proxy.
Distinguish from the purpose:
Forward proxy: The purpose of the forward proxy is to provide access to the Internet on the LAN within the firewall. In addition, you can also use the buffering feature to reduce network usage. Reverse proxy: The purpose of a reverse proxy is to provide access to the server behind the firewall to Internet users. At the same time, functions such as load balancing can also be completed
In terms of security:
Forward proxy: Forward proxy allows clients to access any website through it and is hidden client itself, so you must take security measures to ensure that only authorized clients are served Reverse proxy: It is transparent to the outside world, and visitors do not know that they are accessing a proxy. For the visitor, he thinks he is visiting the original server
For more Nginx-related technical articles, please visit the Nginx Usage Tutorial column to learn!
The above is the detailed content of The difference between nginx forward proxy and reverse proxy. For more information, please follow other related articles on the PHP Chinese website!