From 349aca8f3d969d4a921388756ff9245565a3c18b Mon Sep 17 00:00:00 2001 From: xxm404 Date: Tue, 31 Mar 2020 11:09:29 +0800 Subject: [PATCH 1/5] Fix doc json format error. --- doc/health-check.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/health-check.md b/doc/health-check.md index 00d4e544e305..5bcf58c35085 100644 --- a/doc/health-check.md +++ b/doc/health-check.md @@ -41,7 +41,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 "nodes": { "127.0.0.1:1980": 1, "127.0.0.1:1970": 1 - } + }, "type": "roundrobin", "retries": 2, "checks": { From b0447d888c8849bebb9ed74155b49d1a599607e4 Mon Sep 17 00:00:00 2001 From: xxm404 Date: Tue, 19 May 2020 18:25:48 +0800 Subject: [PATCH 2/5] Fix garbled Chinese response in browser. --- bin/apisix | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/apisix b/bin/apisix index 506af065ddec..f385d812135d 100755 --- a/bin/apisix +++ b/bin/apisix @@ -239,6 +239,7 @@ http { more_set_headers 'Server: APISIX web server'; include mime.types; + charset utf-8; {% if real_ip_header then %} real_ip_header {* real_ip_header *}; From e2d9932f368e6312a416568e6335a9ce77ec032c Mon Sep 17 00:00:00 2001 From: xxm404 Date: Fri, 29 May 2020 18:12:52 +0800 Subject: [PATCH 3/5] Fix document description does not match source code. --- doc/plugins/limit-count-cn.md | 2 +- doc/plugins/limit-count.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/plugins/limit-count-cn.md b/doc/plugins/limit-count-cn.md index 1768ebc638e6..6f7425628ef9 100644 --- a/doc/plugins/limit-count-cn.md +++ b/doc/plugins/limit-count-cn.md @@ -31,7 +31,7 @@ |count |必选 |指定时间窗口内的请求数量阈值| |time_window |必选 |时间窗口的大小(以秒为单位),超过这个时间就会重置| |key |必选 |是用来做请求计数的依据,当前接受的 key 有: "remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for"。| -|rejected_code |可选 |T当请求超过阈值被拒绝时,返回的 HTTP 状态码,默认是 503| +|rejected_code |必选 |T当请求超过阈值被拒绝时,返回的 HTTP 状态码。| |policy |可选 |用于检索和增加限制的速率限制策略。可选的值有:`local`(计数器被以内存方式保存在节点本地,默认选项) 和 `redis`(计数器保存在 Redis 服务节点上,从而可以跨节点共享结果,通常用它来完成全局限速).| |redis_host |可选 |当使用 `redis` 限速策略时,该属性是 Redis 服务节点的地址。| |redis_port |可选 |当使用 `redis` 限速策略时,该属性是 Redis 服务节点的端口,默认端口 6379。| diff --git a/doc/plugins/limit-count.md b/doc/plugins/limit-count.md index 44eca68e8462..51fb6de63e58 100644 --- a/doc/plugins/limit-count.md +++ b/doc/plugins/limit-count.md @@ -38,7 +38,7 @@ Limit request rate by a fixed number of requests in a given time window. |count |required|the specified number of requests threshold.| |time_window |required|the time window in seconds before the request count is reset.| |key |required|the user specified key to limit the rate. Here is fully key list: "remote_addr", "server_addr", "http_x_real_ip", "http_x_forwarded_for".| -|rejected_code |optional|The HTTP status code returned when the request exceeds the threshold is rejected. The default is 503.| +|rejected_code |required|The HTTP status code returned when the request exceeds the threshold is rejected.| |policy |optional|The rate-limiting policies to use for retrieving and incrementing the limits. Available values are `local`(the counters will be stored locally in-memory on the node, default value) and `redis`(counters are stored on a Redis server and will be shared across the nodes, usually used it to do the global speed limit).| |redis_host |optional|When using the `redis` policy, this property specifies the address of the Redis server.| |redis_port |optional|When using the `redis` policy, this property specifies the port of the Redis server. The default port is 6379.| From 677f03e278acfeebf27c556972af1648b0dae5bf Mon Sep 17 00:00:00 2001 From: xxm404 Date: Mon, 15 Jun 2020 21:28:31 +0800 Subject: [PATCH 4/5] Change: use to scan the items in etcd. close #1685 --- apisix/http/router/radixtree_sni.lua | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/apisix/http/router/radixtree_sni.lua b/apisix/http/router/radixtree_sni.lua index 0ecc3bf3cbb2..e3f2b456cad7 100644 --- a/apisix/http/router/radixtree_sni.lua +++ b/apisix/http/router/radixtree_sni.lua @@ -18,7 +18,7 @@ local get_request = require("resty.core.base").get_request local radixtree_new = require("resty.radixtree").new local core = require("apisix.core") local ngx_ssl = require("ngx.ssl") -local ipairs = ipairs +local config_util = require("apisix.core.config_util") local type = type local error = error local ssl_certificates @@ -38,20 +38,18 @@ local function create_router(ssl_items) local route_items = core.table.new(#ssl_items, 0) local idx = 0 - for _, ssl in ipairs(ssl_items) do - if type(ssl) == "table" then - local sni = ssl.value.sni:reverse() - idx = idx + 1 - route_items[idx] = { - paths = sni, - handler = function (api_ctx) - if not api_ctx then - return - end - api_ctx.matched_ssl = ssl + for _, ssl in config_util.iterate_values(ssl_items) do + local sni = ssl.value.sni:reverse() + idx = idx + 1 + route_items[idx] = { + paths = sni, + handler = function (api_ctx) + if not api_ctx then + return end - } - end + api_ctx.matched_ssl = ssl + end + } end core.log.info("route items: ", core.json.delay_encode(route_items, true)) From 5e2dd76269ffaadc15203a1bd8db89a7767d29f5 Mon Sep 17 00:00:00 2001 From: xxm404 Date: Tue, 16 Jun 2020 11:48:22 +0800 Subject: [PATCH 5/5] Add ipairs. --- apisix/http/router/radixtree_sni.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/apisix/http/router/radixtree_sni.lua b/apisix/http/router/radixtree_sni.lua index 4465a8b1bdf0..1eb7aa54508b 100644 --- a/apisix/http/router/radixtree_sni.lua +++ b/apisix/http/router/radixtree_sni.lua @@ -19,6 +19,7 @@ local radixtree_new = require("resty.radixtree").new local core = require("apisix.core") local ngx_ssl = require("ngx.ssl") local config_util = require("apisix.core.config_util") +local ipairs = ipairs local type = type local error = error local str_find = string.find