https://www.zhihu.com/question/24723688/answer/160252724

反向代理
在计算机世界里,由于单个服务器的处理客户端(用户)请求能力有一个极限,当用户的接入请求蜂拥而入时,会造成服务器忙不过来的局面,可以使用多个服务器来共同分担成千上万的用户请求,这些服务器提供相同的服务,对于用户来说,根本感觉不到任何差别。

反向代理的实现
1)需要有一个负载均衡设备来分发用户请求,将用户请求分发到空闲的服务器上

2)服务器返回自己的服务到负载均衡设备

3)负载均衡将服务器的服务返回用户

以上的潜台词是:用户和负载均衡设备直接通信,也意味着用户做服务器域名解析时,解析得到的IP其实是负载均衡的IP,而不是服务器的IP,这样有一个好处是,当新加入/移走服务器时,仅仅需要修改负载均衡的服务器列表,而不会影响现有的服务。

https://en.wikipedia.org/wiki/Reverse_proxy

反向代理的主要作用为:

对客户端隐藏伺服器(丛集)的IP位址
安全:作为应用层防火牆,为网站提供对基于Web的攻击行爲(例如DoS/DDoS)的防护,更容易排查恶意软体等
为后端伺服器(丛集)统一提供加密和SSL加速(如SSL终端代理)
负载均衡,若伺服器丛集中有负荷较高者,反向代理通过URL重写,根据连线请求从负荷较低者获取与所需相同的资源或备援
对于静态内容及短时间内有大量存取请求的动态内容提供快取服务
对一些内容进行压缩,以节约频宽或为网路频宽不佳的网路提供服务
减速上传
为在私有网路下(如区域网路)的伺服器丛集提供NAT穿透及外网发布服务
提供HTTP存取认证[2]
突破互联网封锁(不常用,因为反向代理与客户端之间的连线不一定是加密连线,非加密连线仍有遭内容审查进而遭封禁的风险;此外面对针对网域名称的关键字过滤、DNS快取污染/投毒攻击乃至深度封包检测也无能为力)

Difference between proxy server and reverse proxy server

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 websites.

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 administrative 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 website.

        • 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 website. 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.

Links to topics from the post:

Content Delivery Network

  • Lists of CDNs

    • http://www.mytestbox.com/miscellaneous/content-delivery-networks-cdn-list/
    • http://blog.streamingmedia.com/the_business_of_online_vi/2008/01/updated-list-of.html

forward proxy software (server side)

  • PHP-Proxy
  • cgi-proxy
  • phproxy (discontinued)
  • glype
  • Internet censorship wiki: List of Web Proxies
  • squid (apparently, can also work as a reverse proxy)

reverse proxy software for HTTP (server side)

  • apache mod_proxy (can also work as a forward proxy for HTTP)
  • nginx (used on hulu.com, spam sites, etc.)
  • HAProxy
  • lighthttpd
  • perlbal (written for livejournal)
  • portfusion
  • pound
  • varnish cache (written by a freebsd kernel guru)
  • repose

reverse proxy software for TCP (server side)

  • balance
  • delegate
  • pen
  • portfusion
  • pure load balancer (web site defunct)
  • python director

see also:

  • Wikipedia - Content Delivery Network
  • Wikipedia - Category:Reverse_proxy
  • Wikipedia - Load Balancing
  • Wikipedia - Scalability

转载于:https://www.cnblogs.com/chucklu/p/10844468.html

反向代理Reverse proxy相关推荐

  1. Windows下实现反向代理的若干途径

    2019独角兽企业重金招聘Python工程师标准>>> 反向代理 = reverse proxy,通常监听在公网IP的HTTP端口,把来自公网的请求转发到内网的真正web服务器上,并 ...

  2. nginx反向代理模块配置详解_Nginx(三):反向代理负载均衡集群配置详解

    概述: 本篇主要总结Nginx实现反向代理和负载均衡功能相关模块的配置说明.主要使用到的模块如下:ngx_http_proxy_moduleNginx实现反向代理功能 ngx_http_upstrea ...

  3. Nginx学习笔记(反向代理搭建集群)

    一.前言 1.1 大型互联网架构演变历程 1.1.1 淘宝技术 淘宝的核心技术(国内乃至国际的 Top,这还是2011年的数据) 拥有全国最大的分布式 Hadoop 集群(云梯,2000左右节点,24 ...

  4. 反向代理和正向代理之间的区别

    什么是反向代理?反向代理其实基本思想非常的简单,其实就是位于用户和目标服务器之间,当然对于用户来说,反向代理其实就是相当于目标服务器,用户可以直接通过代理服务器获得目标服务器的资源.那么反向代理和正向 ...

  5. 2021-11-03 vue笔记:反向代理介绍和使用场景,基于 vue-cli 的反向代理设置及 axios 获取 json 数据

    文章目录 0.反向代理是什么? 1.正向代理(forward proxy) 2.反向代理(Reverse proxy) 1.为什么要配置反向代理? 2.如何实现vue中配置反向代理? 2.1.安装和引 ...

  6. nginx反向代理打印日志_nginx反向代理笔记

    课前回顾 mysqladmin -uroot password 1#给root用户密码(必须要做) mysql -uroot -p1 create database wp;#创建数据库 create ...

  7. 正向代理/反向代理/透明代理/透明模式

    1.正向代理(forward)是一个位于客户端和原始服务器(origin server)之间的服务器,为了从原始服务器取得内容,客户端向代理发送一个请求并指定目标(原始服务器),然后代理向原始服务器转 ...

  8. 什么是反向代理(代理服务器解释

    什么是反向代理(reverse proxy)? A reverse proxy protects web servers from attacks and can provide performanc ...

  9. 正向代理、反向代理介绍

    目录 一.定义 1.正向代理(forward proxy) 2.反向代理(Reverse proxy) 3.透明代理(transparent proxy) 二.生活中代理的例子 1.正向代理 2.反向 ...

  10. proxy的正向代理和反向代理

    正反向代理图示: 总结:正向代理代理的对象是客户端,隐藏了真实的客户端            反向代理代理的对象是服务端,隐藏了真实的服务端 正向代理: 正向代理是proxy代理客户端,由多个客户端向 ...

最新文章

  1. 测试驱动开发 测试前移_测试驱动开发简介
  2. Uva1595 对称轴
  3. 一阶系统单位阶跃响应的特点_第八讲 系统的时域响应
  4. YbtOJ-森林之和【dp】
  5. java面试常见面试问题_Java面试准备:15个Java面试问题
  6. python中的分号
  7. 【机器学习】Bagging和Boosting的区别(面试准备)
  8. 前端—每天5道面试题(4)
  9. Atitit 代码的导航 1.1.代码的层次导航 语句 函数方法 类 包 1.2.4.4. 代码可视化 流程图 一个方法内,多个代码行的关系图 语句to方法 2 1.3.4.5. 类图 类结构
  10. php对接易宝支付实现真实交易
  11. 信息学竞赛与 计算机科学,在信息学奥林匹克竞赛中我与学生共成长
  12. RCC BUCK变压器设计
  13. java玫瑰花代码_给爱人的玫瑰花表白程序代码–Java版 | 学步园
  14. jdk卸载,提示Windows Installer安装包有问题,此程序所需要的dll不能运行
  15. 2020年最全最好用的在线文档盘点,建议收藏
  16. 【C++】黑马程序员 C++学习课程—C++基础入门
  17. python实现爬虫探探_全栈 - 9 实战 爬取豆瓣电影数据
  18. C语言顺序结构(解决二元一次方程)
  19. 6亿视频号的8种私域流量变现模式
  20. NOI2022 游记

热门文章

  1. 通信基站中AAU与RRU的功能和区别是什么?
  2. 计算机组成与原理第三章答,计算机组成与原理第三章答案.doc
  3. 基于堆叠双向LSTM的中文诗歌生成
  4. 招聘季!送你21套经典面试题!助你一臂之力!
  5. drupal mysql hash密码_變更drupal7用戶密碼加密方式
  6. PHP 生成 csv 文件时乱码解决
  7. python学习之路之:import(详细介绍import的各种调用原理和使用方法)
  8. Web前端开发CSS学习笔记2—五大类选择器
  9. 网易公开课——可汗学院公开课:现代密码学(1)
  10. Linux 服务器上传文件到阿里网盘