what's the different between forward proxy and reverse proxy?

I get these answers from https://www.zhihu.com/question/24723688 ans http://stackoverflow.com/questions/224664/difference-between-proxy-server-and-reverse-proxy-server/366212#366212


正向代理中,proxy和client同属一个LAN,对server透明;
反向代理中,proxy和server同属一个LAN,对client透明。
实际上proxy在两种代理中做的事都是代为收发请求和响应,不过从结构上来看正好左右互换了下,所以把后出现的那种代理方式叫成了反向代理。

The another answer I got from stackoverflow

The previous answers were accurate, but perhaps too terse. I will try to add some examples.

First of all, the word “proxy” describes someone or something acting on behalf of someone else.

In the computer realm, we are talking about one server acting on the behalf of another computer.

For the purposes of accessibility, I will limit my discussion to web proxies - however, the idea of a proxy is not limited to web sites.

FORWARD proxy

Most discussion of web proxies refers to the type of proxy known as a “forward proxy.”

The proxy event in this case is that the “forward proxy” retrieves data from another web site on behalf of the original requestee.

A tale of 3 computers (part I)

For an example, I will list three computers connected to the internet.

X = your computer, or “client” computer on the internet
Y = the proxy web site, proxy.example.org
Z = the web site you want to visit, www.example.net
Normally, one would connect directly from X –> Z.

However, in some scenarios, it is better for Y –> Z on behalf of X, which chains as follows: X –> Y –> Z.

Reasons why X would want to use a forward proxy server:

Here is a (very) partial list of uses of a forward proxy server.

1) X is unable to access Z directly because
a) Someone with administration authority over X’s internet connection has decided to block all access to site Z.
Examples:
The Storm Worm virus is spreading by tricking people into visiting familypostcards2008.com, so the system administrator has blocked access to the site to prevent users from inadvertently infecting themselves.
Employees at a large company have been wasting too much time on facebook.com, so management wants access blocked during business hours.
A local elementary school disallows internet access to the playboy.com web site.
A government is unable to control the publishing of news, so it controls access to news instead, by blocking sites such as wikipedia.org. See TOR or FreeNet.
b) The administrator of Z has blocked X.
Examples:
The administrator of Z has noticed hacking attempts coming from X, so the administrator has decided to block X’s ip address (and/or netrange).
Z is a forum web site. X is spamming the forum. Z blocks X.
REVERSE proxy

A tale of 3 computers (part II)

For this example, I will list three computers connected to the internet.

X = your computer, or “client” computer on the internet
Y = the reverse proxy web site, proxy.example.com
Z = the web site you want to visit, www.example.net
Normally, one would connect directly from X –> Z.

However, in some scenarios, it is better for the administrator of Z to restrict or disallow direct access, and force visitors to go through Y first. So, as before, we have data being retrieved by Y –> Z on behalf of X, which chains as follows: X –> Y –> Z.

What is different this time compared to a “forward proxy,” is that this time the user X does not know he is accessing Z, because the user X only sees he is communicating with Y. The server Z is invisible to clients and only the reverse proxy Y is visible externally. A reverse proxy requires no (proxy) configuration on the client side.

The client X thinks he is only communicating with Y (X –> Y), but the reality is that Y forwarding all communication (X –> Y –> Z again).

Reasons why Z would want to set up a reverse proxy server:

1) Z wants to force all traffic to its web site to pass through Y first.
a) Z has a large web site that millions of people want to see, but a single web server cannot handle all the traffic. So Z sets up many servers, and puts a reverse proxy on the internet that will send users to the server closest to them when they try to visit Z. This is part of how the Content Distribution Network (CDN) concept works.
Examples:
Apple Trailers uses Akamai
Jquery.com hosts its javascript files using CloudFront CDN (sample).
etc.
2) The administrator of Z is worried about retaliation for content hosted on the server and does not want to expose the main server directly to the public.
a) Owners of Spam brands such as “Canadian Pharmacy” appear to have thousands of servers, while in reality having most websites hosted on far fewer servers. Additionally, abuse complaints about the spam will only shut down the public servers, not the main server.
In the above scenarios, Z has the ability to choose Y.

All in all, it can be concluded as the following answer
A proxy is simply a middleman for communication(requests+responses). Client <-> Proxy <-> Server

Client proxy: ( Client <-> Proxy ) <-> Server

The proxy acts on behalf of the client. Client knows about all 3 machines involved in chain. Server doesn’t.
Server proxy: Client <-> ( Proxy <-> Server )

The proxy acts on behalf of the server. Client only knows about proxy. Server knows whole chain.
Seems to me that forward and reverse are simply confusing, perspective-dependent names for client and server proxy. I suggest abandoning the former for the latter, for explicit communication.

Of course, to further complicate the matter, not every machine is exclusively a client or a server. If there is an ambiguity in context, it’s best to explicitly specify where the proxy lies, and the communications that it tunnels.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值