Showing
1 changed file
with
1 additions
and
19 deletions
@@ -102,25 +102,7 @@ function rate_limit() | @@ -102,25 +102,7 @@ function rate_limit() | ||
102 | ngx.exit(ngx.HTTP_OK) | 102 | ngx.exit(ngx.HTTP_OK) |
103 | end | 103 | end |
104 | 104 | ||
105 | - -- do limit by ip+method, max qps is [max_per_sencond / 10] | ||
106 | - local ip = ngx.var.real_ip | ||
107 | - if not ip then | ||
108 | - return | ||
109 | - end | ||
110 | - local key = ip .. ":" .. req_uri_method | ||
111 | - local max_qps_ip = max_per_sencond / 10 | ||
112 | - if max_qps_ip <= default_minimal_ip_method_qps then | ||
113 | - max_qps_ip = default_minimal_ip_method_qps | ||
114 | - end | ||
115 | - local ret = limit("yh:ngx:limitIP:" .. key, max_qps_ip) | ||
116 | - if not ret then | ||
117 | - ngx.header["Content-Type"]="application/json;charset=utf-8" | ||
118 | - local rsp_body = '{"code":' .. err_code .. ',"message":"'.. err_msg .. '"}' | ||
119 | - ngx.say(rsp_body) | ||
120 | - ngx.exit(ngx.HTTP_OK) | ||
121 | - end | ||
122 | - | ||
123 | - | 105 | + |
124 | 106 | ||
125 | end | 107 | end |
126 | 108 |
-
mentioned in commit 2df2f74d
-
Please register or login to post a comment