The login
registered
Write an article
Home page
Download the APP

The difference between forward and reverse proxies

Jovi_Mac

The difference between forward and reverse proxies

In the process of learning Nginx has not quite understood what is the reverse proxy, of course, also do not know the meaning of forward proxy, so Google a lot, roughly understand what is something, here is mainly from two wonderful articles to understand, one is more academic, The other is relatively simple www.tuicool.com/articles/M7…

1. The concept

A forward proxy is a proxy server (intermediate server) that sits between the client and the target server. To retrieve content from the original server, the client sends a request to the proxy server and specifies the target server, after which the proxy forwards the content to the target server and returns it to the client. In the case of forward proxy, some special Settings must be made on the client to use it.

Reverse proxies are just the opposite. To the client, the reverse proxy acts as the target server. And the client doesn’t need any setup. The client sends a request to the reverse proxy and then reverse proxy requests goes, and will be asked to transfer to the client, make the content just like his own, a client will not be perceived at the back of the reverse proxy service, so don’t need the client to do any Settings, only need to use the reverse proxy server as the real server.

2. The difference between

Forward proxy requires you to proactively set the IP address or domain name of the proxy server for access. Then the specified IP address or domain name is used to obtain access content and return it. However, the reverse proxy does not require you to do any Settings and directly accesses the real IP address or domain name of the server. However, the server automatically redirects and returns the content based on the accessed content. You do not know which machine it finally accesses.

A forward proxy is a proxy client that sends and receives requests for the client and makes the real client invisible to the server. The reverse proxy is a proxy server that sends and receives requests for the server, making the real server invisible to the client.

The two key differences between forward and reverse proxies can also be seen from the above description:

  • Whether to specify the target server
  • The following graph shows the difference between the two:


    Forward proxy and reverse proxy

In 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 clients. In fact, the two types of proxy are used to send and receive requests and responses, but in terms of structure, just left and right under the switch, so the former type of proxy is called forward proxy, the latter is called reverse proxy.

In terms of use:

  • Forward proxy: The forward proxy is used to provide access to the Internet on the LAN inside the firewall. Buffering features can also be used to reduce network usage
  • Reverse proxy: The reverse proxy provides the server behind the firewall for Internet users to access. At the same time, it can also complete functions such as load balancing

In terms of security:

  • Forward proxy: A forward proxy allows clients to access any web site through it and hides the 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. To the visitor, he thinks he is accessing the original server

3. Application scenarios

The typical use of a forward proxy is to provide LAN clients within a firewall with access to the Internet. Forward proxies can also use buffering features to reduce network utilization. The typical use of a reverse proxy is to provide Internet users with access to a server behind a firewall. Reverse proxies can also provide load balancing for multiple servers on the back end, or buffering for servers on the back end that are slower.

3.1 Forward Proxy

From the above introduction, we can guess at least one function of forward proxy (commonly known as over the wall), namely:

User A can’t access Facebook, but can access server B, and server B can access Facebook. So user A accesses server B and uses server B to access Facebook. When server B receives the request, server B accesses Facebook, and Facebook returns the response to server B, and server B returns the response to Server A. In this way, through proxy server B, the wall is achieved.

3.2 Reverse Proxy

From the above, you can also guess at least one function of the reverse proxy (such as load balancing), namely:

Assume that the user A visit www.somesite.com/something.h… , but the something-.html page doesn’t exist on www.somesite.com, so the server that receives the request sneaks it back from another server and returns it to the user, who doesn’t know which machine the something-.html page is on.

The role of reverse proxy is more, here is a simple list:

  • Protect and hide the raw resource server
  • Encryption and SSL acceleration
  • Load balancing
  • Caching static content
  • The compression
  • Slow to upload
  • security
  • Outside the website.

Here are two simple introductions

Protect and hide the raw resource server


The agent role


User A always thinks that it is accessing the original server B rather than the proxy server Z, but in practice the reverse proxy server accepts user A’s reply, obtains user A’s requested resources from the original resource server B, and sends them to user A. Due to the firewall, only proxy server Z is allowed access to raw resource server B. Although the firewall and reverse proxy work together to protect raw resource server B in this virtual environment, user A is unaware of this.

Load balancing


Load balancing


When there is more than one reverse proxy server, we can even make them into clusters. When more users access resource server B, let different proxy server Z (X) answer different users, and then send the resources needed by different users.

3.3 Transparent Proxy

Transparent proxy is similar to forward proxy, except that the client is unaware of the existence of a proxy. It ADAPTS your request and sends a real IP address (if the company restricts network access).

For example, for the sake of work efficiency or safety, COMPANY A blocks the use of QQ software. The employees of COMPANY A connected to the Internet, but found qq was unavailable. That’s what transparent agents do. The company inserts a transparent proxy between the internal network and the external network. This proxy will grab the request content according to the rules. When I meet the request of QQ, I will shield it, thus completing the transparent shielding. Of course, if you understand how this works, you can set up your own forward proxy to bypass the company.

Above is the first article is academic explanation, the next is relatively simple, from mp.weixin.qq.com/s/ikrI3rmSY…

Nginx as one of the most popular HTTP server, it is a reverse proxy server at the same time, refer to the reverse proxy server, some students may think that this is a fuzzy concept, if to the agent, he may understand, but to lead to a positive, agency estimates that meng, the author will try to use simple analogy to explain what these two concepts.

Forward agent

A classmate in the popular business, peoples innovation under the big background of open the road to his business, he is currently one of the biggest problems is the start-up capital, so he decided to find ma father to borrow money, you can imagine, finally touched A rebuff came back, the feeling be nasty under, he thought of A way to find A relationship line, after A message asking for, The original A students college teacher Wang teacher is Ma Yun’s classmate, so A students find Wang teacher, wang teacher to help Ma Yun that borrow 5 million, of course, the last thing became. However, Ma Yun did not know that the money was borrowed by A student, Ma Yun lent it to Mr. Wang, and Mr. Wang finally handed it over to A student. Teacher Wang here played A very key role in this process, which was the agent, or the forward agent. Teacher Wang handled this matter on behalf of STUDENT A. In this process, Ma Yun did not know who the real borrower was, which was very important.

The proxy we often say is only forward proxy, and the process of forward proxy hides the real requesting client. The server does not know who the real client is, and the service requested by the client is requested by proxy server instead. Shadowsocks, a well-known scientific Internet access tool, plays a typical role of forward proxy. You can set up a proxy server in a foreign country and ask the proxy to request Google.com for me. The proxy will return the corresponding structure of the request to me.


Forward agent

The reverse proxy

Everyone had such experiences, call 10086 customer service phone, may be a region of 10086 customer service has several or dozens of, you never need to care about what is at the other end of, call what, male, or a woman, beautiful or handsome, you don’t care, you care about your problem can get a professional solution, All you have to do is dial the switchboard number 10086, and someone will always answer you, sometimes slowly, sometimes quickly. So the switchboard number 10086 here is what we call a reverse proxy. The customer doesn’t know who the real service provider is.

The reverse proxy hides the real server. When we request www.baidu.com, it’s just like dialing 10086. There may be thousands of servers serving us, but you don’t know which one it is, and you don’t need to know. www.baidu.com is our reverse proxy server, which forwards requests to the real server for us. Nginx is a very good reverse proxy server for load balancing.


Reverse da


Recommended readingMore highlights

  • Is the difference between the agent and the reverse proxy This article reprinted from: http://blog.csdn.net/m13666368773/article/details/8… Li Xukai Reading 75 Comments 0 Upvotes 2
  • Forward proxy concept: forward proxy, also known as the proxy, it works like a springboard, put simply, I am a user, I can not access a… Rain dust 1 Read 82 Comments 0 Likes 0
  • Spring Cloud provides developers with tools to quickly build common patterns in distributed systems (e.g., configuration management, service discovery, circuit breakers, intelligence… Kakaro 2017 Read 75,545 comments 12 likes 116
  • Enterprise Standard of State Grid Corporation of China (Q/GDW) – Object oriented electricity information data Exchange protocol Court said read 3,523 comments 3 likes 7
  • Today, I went to see an old friend we used to work together. At that time, we met each other very soon and talked about everything. After she did not work, she ran her own business, so we had little contact. Long time no… Read 180 comments 0 Likes 1