V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
telu
V2EX  ›  程序员

反向代理服务器限流请教

  •  
  •   telu · 2016-05-21 11:58:10 +08:00 · 2007 次点击
    这是一个创建于 2947 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我经过反向代理将网站的推送服务转移到另一个服务器,现在还想对这块内容进行限流,

    在新服务器设置限流时使用 MAP 之后,限制结果还是只能针对内网的服务器,而不是针对真实IP

    反向代理配置

    
    proxy_set_header X-Forwarded-For $remote_addr;
    #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #proxy_set_header X-Real-IP  $remote_addr;
    #proxy_set_header Host $host;
    
    

    限流配置

    
    map $http_x_forwarded_for  $clientRealIp {
        "" $remote_addr;
        ~^(?P<firstaddr>[0-9\.]+),?.*$ $firstAddr;
    }
    #limit_req_zone $binary_remote_addr zone=allips:10m rate=2r/m;
    limit_req_zone $clientRealIp zone=allips:10m rate=2r/m;
    limit_req zone=allips burst=5 nodelay;
    
    

    请问一下要怎样才能对真实 IP 限流呢。

    设置参考了 http://zhangge.net/4879.html

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1086 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 23:21 · PVG 07:21 · LAX 16:21 · JFK 19:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.