2016-08-01 78 views
0

我使用雲數據庫服務的任何服務,cloudant是具體的,它可以讓具有良好的授權系統直接每用戶訪問數據庫有我可以使用用戶水浸請求限制到我的服務器

然而它也是一項服務,可以很好地擴展和計算每個訪問服務器的計費,0.0015 $每500個獲得請求

所以我想到的任何服務將像代理或CDN或防火牆,我可以限制每分鐘

例如用戶訪問頻率,我想拒絕的用戶,如果對方,讓鐵道部Ë每分鐘超過20個請求或每秒超過2個請求,這樣的事情,所以我可以保護一些用戶嘗試洪水請求我的服務

是否有任何這樣的服務?它叫什麼?還有什麼你可能會建議我?

非常感謝您

回答

1

一些可能的CDN提供這一點,但你必須與他們的銷售/支持團隊或檢查文檔。但是,如果你有機會到你可以安裝nginx的服務器,它具有要求限制功能,這可能會做的正是你想要的。

它在「limit req」模塊中。一些配置可能工作你的情況:

http { 
    limit_req_zone $binary_remote_addr zone=dbzoneip:10m rate=2r/s; 
    # or limit_req_zone $binary_remote_addr zone=dbzoneip:10m rate=20r/m; 
    # You can set this up if you want to limit total requests, 
    # regardless of the incoming IP 
    limit_req_zone $server_name zone=dbzoneserver:10m rate=100r/m; 

    # this would be for whatever the path is to the db API 
    location /db/ { 
     # now we use it 
     # check docs to determine if you want to enable bursting 
     # which allows you to buffer a small number of requests 
     limit_req zone=dbzoneip; 

     # comment this out if you just want to limit particular users 
     limit_req zone=dbzoneserver; 

     proxy_pass https://url_or_ip_of_cloudant; 
    } 
} 
相關問題