(apisix) branch master updated: chore: code style(multi-auth) (#11508)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new b5ea128fe chore: code style(multi-auth) (#11508) b5ea128fe is described below commit b5ea128fe37dbe1fa8de5b46e3c06468804f2a3c Author: 徐瑞东 AuthorDate: Fri Sep 13 09:39:15 2024 +0800 chore: code style(multi-auth) (#11508) --- apisix/plugins/multi-auth.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apisix/plugins/multi-auth.lua b/apisix/plugins/multi-auth.lua index 755846fe1..855734474 100644 --- a/apisix/plugins/multi-auth.lua +++ b/apisix/plugins/multi-auth.lua @@ -50,7 +50,7 @@ function _M.check_schema(conf) local auth = require("apisix.plugins." .. auth_plugin_name) if auth == nil then return false, auth_plugin_name .. " plugin did not found" -else +else if auth.type ~= 'auth' then return false, auth_plugin_name .. " plugin is not supported" end
(apisix-website) branch master updated: docs: add CVE-2024-32638 post (#1795)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-website.git The following commit(s) were added to refs/heads/master by this push: new f8d090ce58b docs: add CVE-2024-32638 post (#1795) f8d090ce58b is described below commit f8d090ce58b1557e3922444623557f3f7e71c8ac Author: YuanSheng Wang AuthorDate: Mon May 6 09:07:58 2024 +0800 docs: add CVE-2024-32638 post (#1795) --- blog/en/blog/2024/05/02/cve-2024-32638.md | 36 +++ blog/zh/blog/2024/05/02/cve-2024-32638.md | 36 +++ 2 files changed, 72 insertions(+) diff --git a/blog/en/blog/2024/05/02/cve-2024-32638.md b/blog/en/blog/2024/05/02/cve-2024-32638.md new file mode 100644 index 000..116afd76b72 --- /dev/null +++ b/blog/en/blog/2024/05/02/cve-2024-32638.md @@ -0,0 +1,36 @@ +--- +title: "Forward-Auth Plugin Request Smuggling( CVE-2024-32638 )" +keywords: +- Vulnerability +- forward-auth +- Smuggling +description: Inconsistent Interpretation of HTTP Requests ('HTTP Request Smuggling') vulnerability in Apache APISIX when using `forward-auth` plugin. +tags: [Security] +--- + +> In APISIX 3.8.0, 3.9.0, there is a problem of HTTP Request Smuggling caused by the `forward-auth` plugin. + + +## Problem Description + +Inconsistent Interpretation of HTTP Requests ('HTTP Request Smuggling') vulnerability in Apache APISIX when using `forward-auth` plugin. + +## Affected Versions + +This issue affects Apache APISIX: from 3.8.0, 3.9.0 . + +## Solution + +If you are using version 3.8.0, 3.9.0, highly recommended to upgrade to version 3.8.1, 3.9.1 or higher, which fixes the issue. + +## Vulnerability details + +Severity:low + +Vulnerability public date: May 2, 2024 + +CVE details: https://nvd.nist.gov/vuln/detail/CVE-2024-32638 + +## Contributor Profile + +Discovered and reported by Brandon Arp and Bruno Green of Topsort. Thank you for your contribution to the Apache APISIX community. diff --git a/blog/zh/blog/2024/05/02/cve-2024-32638.md b/blog/zh/blog/2024/05/02/cve-2024-32638.md new file mode 100644 index 000..f9c746832d5 --- /dev/null +++ b/blog/zh/blog/2024/05/02/cve-2024-32638.md @@ -0,0 +1,36 @@ +--- +title: "Forward-Auth 插件能够发出非法 Smuggling 请求 ( CVE-2024-32638 )" +keywords: +- 安全漏洞 +- forward-auth +- Smuggling +description: 使用 “forward-auth” 插件时,Apache APISIX 能够发出 HTTP 非法请求(“HTTP Request Smuggling”)导致安全漏洞 +tags: [Security] +--- + +> 对于 APISIX 3.8.0, 3.9.0 版本,启用 “forward-auth” 插件时,APISIX 能够发出非法请求(HTTP Request Smuggling)。 + + +## 问题描述 + +启用 “forward-auth” 插件时,APISIX 能够发出非法请求(HTTP Request Smuggling)导致安全漏洞。 + +## 影响版本 + +该风险会影响 Apache APISIX `3.8.0` 和 `3.9.0` 两版本。 + +## 解决方案 + +对于正在使用 3.8.0,3.9.0 的 Apache APISIX 用户,推荐升级到 3.8.1,3.9.1 或更高版本。 + +## 漏洞详情 + +漏洞优先级:低 + +漏洞公开时间:2024 年 5 月 2 日 + +CVE 详细信息:https://nvd.nist.gov/vuln/detail/CVE-2024-32638 + +## 贡献者简介 + +该漏洞有来自 Topsort 公司的 Brandon Arp 和 Bruno Green 发现并报告。感谢各位对 Apache APISIX 社区的贡献。
(apisix) branch release/3.9 updated: chore: upgrade version number (#11191)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch release/3.9 in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/release/3.9 by this push: new 507f0a02d chore: upgrade version number (#11191) 507f0a02d is described below commit 507f0a02dcf1d019d686ebf68594bf123bf4a0d8 Author: YuanSheng Wang AuthorDate: Wed Apr 24 12:22:48 2024 +0800 chore: upgrade version number (#11191) --- apisix/core/version.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apisix/core/version.lua b/apisix/core/version.lua index cf6ddb86c..6ca8796d6 100644 --- a/apisix/core/version.lua +++ b/apisix/core/version.lua @@ -20,5 +20,5 @@ -- @module core.version return { -VERSION = "3.9.0" +VERSION = "3.9.1" }
(apisix) branch release/3.8 updated: chore: upgrade version number (#11190)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch release/3.8 in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/release/3.8 by this push: new addcbcdaa chore: upgrade version number (#11190) addcbcdaa is described below commit addcbcdaa257d0a04d27af2a10fcf1979e34d152 Author: YuanSheng Wang AuthorDate: Wed Apr 24 12:22:21 2024 +0800 chore: upgrade version number (#11190) --- apisix/core/version.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apisix/core/version.lua b/apisix/core/version.lua index d3519aeee..f5e1ffbc9 100644 --- a/apisix/core/version.lua +++ b/apisix/core/version.lua @@ -20,5 +20,5 @@ -- @module core.version return { -VERSION = "3.8.0" +VERSION = "3.8.1" }
(apisix) branch release/3.9 updated: docs: release version 3.9.1 (#11185)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch release/3.9 in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/release/3.9 by this push: new 18f2b891e docs: release version 3.9.1 (#11185) 18f2b891e is described below commit 18f2b891e02d6e0ef1d32994775c4e1072961432 Author: YuanSheng Wang AuthorDate: Wed Apr 24 09:46:36 2024 +0800 docs: release version 3.9.1 (#11185) --- CHANGELOG.md | 7 +++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62e13fb88..987559f9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ title: Changelog ## Table of Contents +- [3.9.1](#391) - [3.9.0](#390) - [3.8.0](#380) - [3.7.0](#370) @@ -76,6 +77,12 @@ title: Changelog - [0.7.0](#070) - [0.6.0](#060) +## 3.9.1 + +### Bug Fixes + +- Fix: add post request headers only if auth request method is post (#11184) + ## 3.9.0 ### Change
(apisix) branch release/3.8 updated: docs: release version 3.8.1, add change log (#11181)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch release/3.8 in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/release/3.8 by this push: new 537b85ee8 docs: release version 3.8.1, add change log (#11181) 537b85ee8 is described below commit 537b85ee8ae39a4973cc0c316a9bd46d1f2bc83a Author: YuanSheng Wang AuthorDate: Tue Apr 23 17:26:38 2024 +0800 docs: release version 3.8.1, add change log (#11181) --- CHANGELOG.md | 7 +++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c72b0ca2..9bcabdd9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ title: Changelog ## Table of Contents +- [3.8.1](#381) - [3.8.0](#380) - [3.7.0](#370) - [3.6.0](#360) @@ -75,6 +76,12 @@ title: Changelog - [0.7.0](#070) - [0.6.0](#060) +## 3.8.1 + +### Bugfixes + +- fix: add post request headers only if auth request method is post (#11174) + ## 3.8.0 ### Core
(apisix) branch release/3.9 updated: fix: add post request headers only if auth request method is post (#11184)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch release/3.9 in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/release/3.9 by this push: new c1560a806 fix: add post request headers only if auth request method is post (#11184) c1560a806 is described below commit c1560a806b5e53eaf3a27f5471b4a74227ff56c8 Author: YuanSheng Wang AuthorDate: Tue Apr 23 17:14:49 2024 +0800 fix: add post request headers only if auth request method is post (#11184) author: suryaprabhakark sync #11021 --- apisix/plugins/forward-auth.lua | 10 ++- t/plugin/forward-auth2.t| 185 2 files changed, 192 insertions(+), 3 deletions(-) diff --git a/apisix/plugins/forward-auth.lua b/apisix/plugins/forward-auth.lua index 69dc48de6..95f04994c 100644 --- a/apisix/plugins/forward-auth.lua +++ b/apisix/plugins/forward-auth.lua @@ -89,11 +89,15 @@ function _M.access(conf, ctx) ["X-Forwarded-Host"] = core.request.get_host(ctx), ["X-Forwarded-Uri"] = ctx.var.request_uri, ["X-Forwarded-For"] = core.request.get_remote_client_ip(ctx), -["Expect"] = core.request.header(ctx, "expect"), -["Content-Length"] = core.request.header(ctx, "content-length"), -["Transfer-Encoding"] = core.request.header(ctx, "transfer-encoding") } +if conf.request_method == "POST" then +auth_headers["Content-Length"] = core.request.header(ctx, "content-length") +auth_headers["Expect"] = core.request.header(ctx, "expect") +auth_headers["Transfer-Encoding"] = core.request.header(ctx, "transfer-encoding") +auth_headers["Content-Encoding"] = core.request.header(ctx, "content-encoding") +end + -- append headers that need to be get from the client request header if #conf.request_headers > 0 then for _, header in ipairs(conf.request_headers) do diff --git a/t/plugin/forward-auth2.t b/t/plugin/forward-auth2.t new file mode 100644 index 0..f90841ede --- /dev/null +++ b/t/plugin/forward-auth2.t @@ -0,0 +1,185 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +use t::APISIX 'no_plan'; + +repeat_each(1); +no_long_string(); +no_root_location(); + +add_block_preprocessor(sub { +my ($block) = @_; + +if (!defined $block->request) { +$block->set_value("request", "GET /t"); +} +}); + +run_tests(); + +__DATA__ + +=== TEST 1: setup route with plugin +--- config +location /t { +content_by_lua_block { +local data = { +{ +url = "/apisix/admin/upstreams/u1", +data = [[{ +"nodes": { +"127.0.0.1:1984": 1 +}, +"type": "roundrobin" +}]], +}, +{ +url = "/apisix/admin/routes/auth", +data = { +plugins = { +["serverless-pre-function"] = { +phase = "rewrite", +functions = { +[[return function(conf, ctx) +local core = require("apisix.core"); +local token = "token-headers-test"; +if core.request.header(ctx, "Authorization") == token then +if core.request.get_method() == "POST" then +if core.request.header(ctx, "Content-Length") or +core.request.header(ctx, "Transfer-
(apisix) branch master updated: chore: restore release/3.9 branch protection #11183
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new e40a9d18a chore: restore release/3.9 branch protection #11183 e40a9d18a is described below commit e40a9d18afd1221f3b2d90e402f3b23fd1cf7e34 Author: YuanSheng Wang AuthorDate: Tue Apr 23 15:50:34 2024 +0800 chore: restore release/3.9 branch protection #11183 This reverts commit 005281c13278db16e2a2070854428481b585f0c6. --- .asf.yaml | 4 1 file changed, 4 insertions(+) diff --git a/.asf.yaml b/.asf.yaml index d5fbaa2ab..2fbe3776c 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -53,6 +53,10 @@ github: dismiss_stale_reviews: true require_code_owner_reviews: true required_approving_review_count: 2 + release/3.9: +required_pull_request_reviews: + require_code_owner_reviews: true + required_approving_review_count: 2 release/3.8: required_pull_request_reviews: require_code_owner_reviews: true
(apisix) branch release/3.9.0 deleted (was 9bcabaf12)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch release/3.9.0 in repository https://gitbox.apache.org/repos/asf/apisix.git was 9bcabaf12 feat: release 3.9.0 (#11061) The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(apisix) branch release/3.9 created (now 9bcabaf12)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch release/3.9 in repository https://gitbox.apache.org/repos/asf/apisix.git at 9bcabaf12 feat: release 3.9.0 (#11061) No new revisions were added by this update.
(apisix) branch release/3.9 deleted (was 1b11b88ad)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch release/3.9 in repository https://gitbox.apache.org/repos/asf/apisix.git was 1b11b88ad fix: add post request headers only if auth request method is post (#11175) The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(apisix) 01/01: fix: add post request headers only if auth request method is post (#11175)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch release/3.9-invalid-delete-soon in repository https://gitbox.apache.org/repos/asf/apisix.git commit 1b11b88adabda7e4d3c8803210607666756bbfb5 Author: YuanSheng Wang AuthorDate: Sun Apr 21 20:47:30 2024 +0800 fix: add post request headers only if auth request method is post (#11175) author: suryaprabhakark --- apisix/plugins/forward-auth.lua | 10 ++- t/plugin/forward-auth2.t| 185 2 files changed, 192 insertions(+), 3 deletions(-) diff --git a/apisix/plugins/forward-auth.lua b/apisix/plugins/forward-auth.lua index 69dc48de6..95f04994c 100644 --- a/apisix/plugins/forward-auth.lua +++ b/apisix/plugins/forward-auth.lua @@ -89,11 +89,15 @@ function _M.access(conf, ctx) ["X-Forwarded-Host"] = core.request.get_host(ctx), ["X-Forwarded-Uri"] = ctx.var.request_uri, ["X-Forwarded-For"] = core.request.get_remote_client_ip(ctx), -["Expect"] = core.request.header(ctx, "expect"), -["Content-Length"] = core.request.header(ctx, "content-length"), -["Transfer-Encoding"] = core.request.header(ctx, "transfer-encoding") } +if conf.request_method == "POST" then +auth_headers["Content-Length"] = core.request.header(ctx, "content-length") +auth_headers["Expect"] = core.request.header(ctx, "expect") +auth_headers["Transfer-Encoding"] = core.request.header(ctx, "transfer-encoding") +auth_headers["Content-Encoding"] = core.request.header(ctx, "content-encoding") +end + -- append headers that need to be get from the client request header if #conf.request_headers > 0 then for _, header in ipairs(conf.request_headers) do diff --git a/t/plugin/forward-auth2.t b/t/plugin/forward-auth2.t new file mode 100644 index 0..f90841ede --- /dev/null +++ b/t/plugin/forward-auth2.t @@ -0,0 +1,185 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +use t::APISIX 'no_plan'; + +repeat_each(1); +no_long_string(); +no_root_location(); + +add_block_preprocessor(sub { +my ($block) = @_; + +if (!defined $block->request) { +$block->set_value("request", "GET /t"); +} +}); + +run_tests(); + +__DATA__ + +=== TEST 1: setup route with plugin +--- config +location /t { +content_by_lua_block { +local data = { +{ +url = "/apisix/admin/upstreams/u1", +data = [[{ +"nodes": { +"127.0.0.1:1984": 1 +}, +"type": "roundrobin" +}]], +}, +{ +url = "/apisix/admin/routes/auth", +data = { +plugins = { +["serverless-pre-function"] = { +phase = "rewrite", +functions = { +[[return function(conf, ctx) +local core = require("apisix.core"); +local token = "token-headers-test"; +if core.request.header(ctx, "Authorization") == token then +if core.request.get_method() == "POST" then +if core.request.header(ctx, "Content-Length") or +core.request.header(ctx, "Transfer-Encoding") or +core.request.header(ctx, "Content-Encoding") then +core.response.exit(200) +
(apisix) branch release/3.9-invalid-delete-soon created (now 1b11b88ad)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch release/3.9-invalid-delete-soon in repository https://gitbox.apache.org/repos/asf/apisix.git at 1b11b88ad fix: add post request headers only if auth request method is post (#11175) This branch includes the following new commits: new 1b11b88ad fix: add post request headers only if auth request method is post (#11175) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
(apisix) branch master updated: chore: remove useless file error_handling.lua (#10924)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 45c121867 chore: remove useless file error_handling.lua (#10924) 45c121867 is described below commit 45c121867baeef9ccfeeaf811a5cfc65f5eabb69 Author: Abhishek Choudhary AuthorDate: Thu Feb 8 08:35:51 2024 +0545 chore: remove useless file error_handling.lua (#10924) --- apisix/error_handling.lua | 50 --- 1 file changed, 50 deletions(-) diff --git a/apisix/error_handling.lua b/apisix/error_handling.lua deleted file mode 100644 index 524c46b2c..0 --- a/apisix/error_handling.lua +++ /dev/null @@ -1,50 +0,0 @@ --- --- Licensed to the Apache Software Foundation (ASF) under one or more --- contributor license agreements. See the NOTICE file distributed with --- this work for additional information regarding copyright ownership. --- The ASF licenses this file to You under the Apache License, Version 2.0 --- (the "License"); you may not use this file except in compliance with --- the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- -local core = require("apisix.core") -local ngx = ngx - - -local _M = {} -local page_500 = [[ - - - - -500 Internal Server Error - -body { -width: 35em; -margin: 0 auto; -font-family: Tahoma, Verdana, Arial, sans-serif; -} - - - -An error occurred. -You can report issue to https://github.com/apache/apisix/issues";>APISIX -Faithfully yours, https://apisix.apache.org/";>APISIX. - -]] - - -function _M.handle_500() -core.response.set_header("Content-Type", "text/html") -ngx.say(page_500) -end - - -return _M
[apisix] branch moonming-patch-2 deleted (was c3d7bc261)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch moonming-patch-2 in repository https://gitbox.apache.org/repos/asf/apisix.git was c3d7bc261 Update .asf.yaml The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[apisix] branch SkyeYoung-patch-1 deleted (was 3c44c7570)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch SkyeYoung-patch-1 in repository https://gitbox.apache.org/repos/asf/apisix.git was 3c44c7570 docs(admin-api.md): code block syntax (v3.2) The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[apisix] branch docs/tutorial-websocket-authentication deleted (was 0d936d873)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch docs/tutorial-websocket-authentication in repository https://gitbox.apache.org/repos/asf/apisix.git was 0d936d873 docs: added missing plugin The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[apisix] branch moonming-patch-1 deleted (was 1c0c01232)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch moonming-patch-1 in repository https://gitbox.apache.org/repos/asf/apisix.git was 1c0c01232 Update docs/en/latest/FAQ.md The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[apisix] branch patch-1 deleted (was b3bf9fa1b)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch patch-1 in repository https://gitbox.apache.org/repos/asf/apisix.git was b3bf9fa1b resolve code review The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[apisix] branch juzhiyuan-patch-1 deleted (was 89f509804)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch juzhiyuan-patch-1 in repository https://gitbox.apache.org/repos/asf/apisix.git was 89f509804 docs: fix 404 link The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[apisix] branch master updated: docs: updates multi-lang-support image (#8545)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 059d0b8a8 docs: updates multi-lang-support image (#8545) 059d0b8a8 is described below commit 059d0b8a894e9900cc7519b77fbc934746503b8e Author: dongjunduo AuthorDate: Thu Dec 22 10:58:27 2022 +0800 docs: updates multi-lang-support image (#8545) --- README.md| 2 +- docs/zh/latest/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b3e9ca937..52b4c9fcb 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ A/B testing, canary release, blue-green deployment, limit rate, defense against - **Multi-Language support** - Apache APISIX is a multi-language gateway for plugin development and provides support via `RPC` and `Wasm`. - ![Multi Language Support into Apache APISIX](docs/assets/images/apisix-multi-lang-support.png) + ![Multi Language Support into Apache APISIX](docs/assets/images/external-plugin.png) - The RPC way, is the current way. Developers can choose the language according to their needs and after starting an independent process with the RPC, it exchanges data with APISIX through local RPC communication. Till this moment, APISIX has support for [Java](https://github.com/apache/apisix-java-plugin-runner), [Golang](https://github.com/apache/apisix-go-plugin-runner), [Python](https://github.com/apache/apisix-python-plugin-runner) and Node.js. - The Wasm or WebAssembly, is an experimental way. APISIX can load and run Wasm bytecode via APISIX [wasm plugin](https://github.com/apache/apisix/blob/master/docs/en/latest/wasm.md) written with the [Proxy Wasm SDK](https://github.com/proxy-wasm/spec#sdks). Developers only need to write the code according to the SDK and then compile it into a Wasm bytecode that runs on Wasm VM with APISIX. diff --git a/docs/zh/latest/README.md b/docs/zh/latest/README.md index 3adff87a0..73b2fad03 100644 --- a/docs/zh/latest/README.md +++ b/docs/zh/latest/README.md @@ -154,7 +154,7 @@ A/B 测试、金丝雀发布(灰度发布)、蓝绿部署、限流限速、 - **多语言支持** - Apache APISIX 是一个通过 `RPC` 和 `Wasm` 支持不同语言来进行插件开发的网关。 - ![Multi Language Support into Apache APISIX](../../../docs/assets/images/apisix-multi-lang-support.png) + ![Multi Language Support into Apache APISIX](../../../docs/assets/images/external-plugin.png) - RPC 是当前采用的开发方式。开发者可以使用他们需要的语言来进行 RPC 服务的开发,该 RPC 通过本地通讯来跟 APISIX 进行数据交换。到目前为止,APISIX 已支持[Java](https://github.com/apache/apisix-java-plugin-runner), [Golang](https://github.com/apache/apisix-go-plugin-runner), [Python](https://github.com/apache/apisix-python-plugin-runner) 和 Node.js。 - Wasm 或 WebAssembly 是实验性的开发方式。 APISIX 能加载运行使用[Proxy Wasm SDK](https://github.com/proxy-wasm/spec#sdks)编译的 Wasm 字节码。开发者仅需要使用该 SDK 编写代码,然后编译成 Wasm 字节码,即可运行在 APISIX 中的 Wasm 虚拟机中。
[apisix] branch master updated: fix(ai): use # to concat route cache key parts (#8128)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new ee24e5a3d fix(ai): use # to concat route cache key parts (#8128) ee24e5a3d is described below commit ee24e5a3df8da5a1b5bcb63394ac39253f351af3 Author: jinhua luo AuthorDate: Thu Oct 20 17:09:56 2022 +0800 fix(ai): use # to concat route cache key parts (#8128) better performance and much clearer --- apisix/plugins/ai.lua | 7 +++ t/plugin/ai.t | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apisix/plugins/ai.lua b/apisix/plugins/ai.lua index 6b60aac29..cb69f59a7 100644 --- a/apisix/plugins/ai.lua +++ b/apisix/plugins/ai.lua @@ -21,7 +21,6 @@ local event = require("apisix.core.event") local ipairs = ipairs local pcall = pcall local loadstring = loadstring -local encode_base64 = ngx.encode_base64 local get_cache_key_func local get_cache_key_func_def_render @@ -31,10 +30,10 @@ return function(ctx) local var = ctx.var return var.uri {% if route_flags["methods"] then %} -.. "\0" .. var.method +.. "#" .. var.method {% end %} {% if route_flags["host"] then %} -.. "\0" .. var.host +.. "#" .. var.host {% end %} end ]] @@ -68,7 +67,7 @@ end local function ai_match(ctx) local key = get_cache_key_func(ctx) -core.log.info("route cache key: ", core.log.delay_exec(encode_base64, key)) +core.log.info("route cache key: ", key) local ver = router.router_http.user_routes.conf_version local route_cache = route_lrucache(key, ver, match_route, ctx) diff --git a/t/plugin/ai.t b/t/plugin/ai.t index 3c0cd62d9..9415771ab 100644 --- a/t/plugin/ai.t +++ b/t/plugin/ai.t @@ -520,7 +520,7 @@ use ai plane to match route --- response_body done --- error_log -route cache key: L2hlbGxv +route cache key: /hello @@ -569,7 +569,7 @@ route cache key: L2hlbGxv --- response_body done --- error_log -route cache key: L2hlbGxvAEdFVA== +route cache key: /hello#GET @@ -619,4 +619,4 @@ route cache key: L2hlbGxvAEdFVA== --- response_body done --- error_log -route cache key: L2hlbGxvAEdFVAAxMjcuMC4wLjE= +route cache key: /hello#GET#127.0.0.1
[apisix] branch test_reuse_ctx updated (1c9cf7671 -> 2a9e476b8)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch test_reuse_ctx in repository https://gitbox.apache.org/repos/asf/apisix.git from 1c9cf7671 test: make a try add 2a9e476b8 no message No new revisions were added by this update. Summary of changes: apisix/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
[apisix] branch test_reuse_ctx created (now 1c9cf7671)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch test_reuse_ctx in repository https://gitbox.apache.org/repos/asf/apisix.git at 1c9cf7671 test: make a try This branch includes the following new commits: new 1c9cf7671 test: make a try The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[apisix] 01/01: test: make a try
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch test_reuse_ctx in repository https://gitbox.apache.org/repos/asf/apisix.git commit 1c9cf7671cb4f42c5b77da0d49dff2b5015407fd Author: YuanSheng Wang AuthorDate: Fri Aug 12 15:36:26 2022 +0800 test: make a try --- apisix/init.lua | 4 1 file changed, 4 insertions(+) diff --git a/apisix/init.lua b/apisix/init.lua index 17f1740ef..eb097c1e1 100644 --- a/apisix/init.lua +++ b/apisix/init.lua @@ -322,6 +322,10 @@ function _M.http_access_phase() -- always fetch table from the table pool, we don't need a reused api_ctx local api_ctx = core.tablepool.fetch("api_ctx", 0, 32) +if nkeys(api_ctx) != 0 then +error("hit the wrong case") +api_ctx = {} +end ngx_ctx.api_ctx = api_ctx if not verify_tls_client(api_ctx) then
[apisix] branch master updated: docs: we don't use our fork anymore (#6875)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 0c04da4a9 docs: we don't use our fork anymore (#6875) 0c04da4a9 is described below commit 0c04da4a949d3a1e98d3062f2caf1c3dfaea66eb Author: 罗泽轩 AuthorDate: Tue Apr 19 12:06:05 2022 +0800 docs: we don't use our fork anymore (#6875) Signed-off-by: spacewander --- docs/en/latest/internal/testing-framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/latest/internal/testing-framework.md b/docs/en/latest/internal/testing-framework.md index 85128d418..36dd31d6e 100644 --- a/docs/en/latest/internal/testing-framework.md +++ b/docs/en/latest/internal/testing-framework.md @@ -21,7 +21,7 @@ title: Introducing APISIX's testing framework # --> -APISIX uses a testing framework based on our fork of test-nginx: https://github.com/openresty/test-nginx. +APISIX uses a testing framework based on test-nginx: https://github.com/openresty/test-nginx. For details, you can check the [documentation](https://metacpan.org/pod/Test::Nginx) of this project. If you want to test the CLI behavior of APISIX (`./bin/apisix`),
[apisix] branch master updated: fix: allow `purge` method in `route` (#6780)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new f56923521 fix: allow `purge` method in `route` (#6780) f56923521 is described below commit f56923521c4485c16dc4f13f6ed0cf215d4c5076 Author: soulbird AuthorDate: Wed Apr 6 16:53:16 2022 +0800 fix: allow `purge` method in `route` (#6780) Co-authored-by: soulbird --- apisix/schema_def.lua | 2 +- docs/en/latest/plugins/batch-requests.md | 2 +- docs/en/latest/plugins/consumer-restriction.md | 2 +- docs/zh/latest/admin-api.md| 2 +- docs/zh/latest/plugins/batch-requests.md | 2 +- docs/zh/latest/plugins/consumer-restriction.md | 2 +- rockspec/apisix-master-0.rockspec | 2 +- t/admin/routes3.t | 2 +- t/fuzzing/serverless_route_test.py | 2 +- t/fuzzing/simpleroute_test.py | 2 +- t/fuzzing/vars_route_test.py | 2 +- t/router/radixtree-method.t| 106 + 12 files changed, 117 insertions(+), 11 deletions(-) diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua index b84ce3547..199bee1da 100644 --- a/apisix/schema_def.lua +++ b/apisix/schema_def.lua @@ -523,7 +523,7 @@ local method_schema = { description = "HTTP method", type = "string", enum = {"GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", -"OPTIONS", "CONNECT", "TRACE"}, +"OPTIONS", "CONNECT", "TRACE", "PURGE"}, } _M.method_schema = method_schema diff --git a/docs/en/latest/plugins/batch-requests.md b/docs/en/latest/plugins/batch-requests.md index 7c5a5502e..67f7eeca2 100644 --- a/docs/en/latest/plugins/batch-requests.md +++ b/docs/en/latest/plugins/batch-requests.md @@ -85,7 +85,7 @@ The plugin will create a API in `apisix` to handle your batch request. | Name | Type| Requirement | Default | Valid | Description | | -- | --- | --- | --- | | --- | | version| string | optional| 1.1 | [1.0, 1.1] | http version | -| method | string | optional| GET | ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"] | http method | +| method | string | optional| GET | ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE", "PURGE"] | http method | | query | object | optional| | | request's `query string`, if `Key` is conflicted with global `query`, this setting's value will be used. | | headers| object | optional| | | request's `header`, if `Key` is conflicted with global `headers`, this setting's value will be used. | | path | string | required| | | http request's path | diff --git a/docs/en/latest/plugins/consumer-restriction.md b/docs/en/latest/plugins/consumer-restriction.md index 018c32172..a8ca55c9e 100644 --- a/docs/en/latest/plugins/consumer-restriction.md +++ b/docs/en/latest/plugins/consumer-restriction.md @@ -34,7 +34,7 @@ The `consumer-restriction` makes corresponding access restrictions based on diff | blacklist | array[string] | required | | | Reject connection to all users specified in the provided list , **has the priority over `whitelist`
[apisix] branch master updated: fix: hidding real message when password or username is error (#6707)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new ee7771b fix: hidding real message when password or username is error (#6707) ee7771b is described below commit ee7771b34ed2616cec861dc0c84df4a574fb4014 Author: Gaoll AuthorDate: Sun Mar 27 10:05:16 2022 +0800 fix: hidding real message when password or username is error (#6707) Co-authored-by: root --- apisix/plugins/basic-auth.lua| 4 ++-- apisix/plugins/ldap-auth.lua | 2 +- docs/en/latest/plugins/basic-auth.md | 4 ++-- docs/en/latest/plugins/ldap-auth.md | 4 ++-- docs/zh/latest/plugins/basic-auth.md | 4 ++-- t/plugin/basic-auth.t| 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apisix/plugins/basic-auth.lua b/apisix/plugins/basic-auth.lua index 235154f..83519bf 100644 --- a/apisix/plugins/basic-auth.lua +++ b/apisix/plugins/basic-auth.lua @@ -167,14 +167,14 @@ function _M.rewrite(conf, ctx) -- 3. check user exists local cur_consumer = consumers[username] if not cur_consumer then -return 401, { message = "Invalid user key in authorization" } +return 401, { message = "Invalid user authorization" } end core.log.info("consumer: ", core.json.delay_encode(cur_consumer)) -- 4. check the password is correct if cur_consumer.auth_conf.password ~= password then -return 401, { message = "Password is error" } +return 401, { message = "Invalid user authorization" } end -- 5. hide `Authorization` request header if `hide_credentials` is `true` diff --git a/apisix/plugins/ldap-auth.lua b/apisix/plugins/ldap-auth.lua index 59b48f0..6ea32f0 100644 --- a/apisix/plugins/ldap-auth.lua +++ b/apisix/plugins/ldap-auth.lua @@ -152,7 +152,7 @@ function _M.rewrite(conf, ctx) create_consumer_cache, consumer_conf) local consumer = consumers[userdn] if not consumer then -return 401, {message = "Invalid API key in request"} +return 401, {message = "Invalid user authorization"} end consumer_mod.attach_consumer(ctx, consumer, consumer_conf) diff --git a/docs/en/latest/plugins/basic-auth.md b/docs/en/latest/plugins/basic-auth.md index 6f3dab9..10ccc2c 100644 --- a/docs/en/latest/plugins/basic-auth.md +++ b/docs/en/latest/plugins/basic-auth.md @@ -105,7 +105,7 @@ HTTP/1.1 401 Unauthorized $ curl -i -ubar:bar http://127.0.0.1:9080/hello HTTP/1.1 401 Unauthorized ... -{"message":"Invalid user key in authorization"} +{"message":"Invalid user authorization"} ``` - password is invalid: @@ -114,7 +114,7 @@ HTTP/1.1 401 Unauthorized $ curl -i -ufoo:foo http://127.0.0.1:9080/hello HTTP/1.1 401 Unauthorized ... -{"message":"Password is error"} +{"message":"Invalid user authorization"} ``` - success: diff --git a/docs/en/latest/plugins/ldap-auth.md b/docs/en/latest/plugins/ldap-auth.md index be76a48..6ca6aec 100644 --- a/docs/en/latest/plugins/ldap-auth.md +++ b/docs/en/latest/plugins/ldap-auth.md @@ -104,7 +104,7 @@ HTTP/1.1 401 Unauthorized $ curl -i -uuser:password1 http://127.0.0.1:9080/hello HTTP/1.1 401 Unauthorized ... -{"message":"Invalid user key in authorization"} +{"message":"Invalid user authorization"} ``` - password is invalid: @@ -113,7 +113,7 @@ HTTP/1.1 401 Unauthorized $ curl -i -uuser01:passwordfalse http://127.0.0.1:9080/hello HTTP/1.1 401 Unauthorized ... -{"message":"Password is error"} +{"message":"Invalid user authorization"} ``` - success: diff --git a/docs/zh/latest/plugins/basic-auth.md b/docs/zh/latest/plugins/basic-auth.md index fe44e57..739b048 100644 --- a/docs/zh/latest/plugins/basic-auth.md +++ b/docs/zh/latest/plugins/basic-auth.md @@ -105,7 +105,7 @@ HTTP/1.1 401 Unauthorized $ curl -i -ubar:bar http://127.0.0.1:9080/hello HTTP/1.1 401 Unauthorized ... -{"message":"Invalid user key in authorization"} +{"message":"Invalid user authorization"} ``` - 密码错误: @@ -114,7 +114,7 @@ HTTP/1.1 401 Unauthorized $ curl -i -ufoo:foo http://127.0.0.1:9080/hello HTTP/1.1 401 Unauthorized ... -{"message":"Password is error"} +{"message":"Invalid user authorization"} ... ``` diff --git a/t/plugin/basic-auth.t b/t/plugin/basic-auth.t index 3f0030f..f8cf5ab 100644 --- a/t/plugin/basic-auth.t +++ b/t/plugin/basic-auth.t @@ -196,7 +196,7 @@ GET /hello Authorization: Basic YmFyOmJhcgo= --- error_code: 401 --- response_body -{"message":"Invalid user key in authorization"} +{"message":"Invalid user authorization"} --- no_error_log [error] @@ -209,7 +209,7 @@ GET /hello Authorization: Basic Zm9vOmZvbwo= --- error_code: 401 --- response_body -{"message":"Password is error"} +{"message":"Invalid user authorization"} --- no_error_log [error]
[apisix-docker] branch master updated: feat: upgrade dependency to 1.19.9.1.4 (#294)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-docker.git The following commit(s) were added to refs/heads/master by this push: new 4076105 feat: upgrade dependency to 1.19.9.1.4 (#294) 4076105 is described below commit 407610575b68b8764a3af787c9455e8bd7c1771f Author: leslie <59061168+leslie-ts...@users.noreply.github.com> AuthorDate: Fri Mar 25 09:10:08 2022 +0800 feat: upgrade dependency to 1.19.9.1.4 (#294) --- all-in-one/apisix/Dockerfile | 2 +- alpine-dev/Dockerfile| 2 +- alpine/Dockerfile| 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/all-in-one/apisix/Dockerfile b/all-in-one/apisix/Dockerfile index ea38e0b..be76b59 100644 --- a/all-in-one/apisix/Dockerfile +++ b/all-in-one/apisix/Dockerfile @@ -20,7 +20,7 @@ ARG APISIX_VERSION=2.12.1 ARG ETCD_VERSION=v3.4.14 # Build Apache APISIX -FROM api7/apisix-base:1.19.9.1.3 AS production-stage +FROM api7/apisix-base:1.19.9.1.4 AS production-stage ARG APISIX_VERSION LABEL apisix_version="${APISIX_VERSION}" diff --git a/alpine-dev/Dockerfile b/alpine-dev/Dockerfile index 51fa66a..13aa967 100644 --- a/alpine-dev/Dockerfile +++ b/alpine-dev/Dockerfile @@ -17,7 +17,7 @@ ARG ENABLE_PROXY=false -FROM api7/apisix-base:1.19.9.1.3 AS production-stage +FROM api7/apisix-base:1.19.9.1.4 AS production-stage ARG ENABLE_PROXY RUN set -x \ diff --git a/alpine/Dockerfile b/alpine/Dockerfile index 628fcda..02a52f3 100644 --- a/alpine/Dockerfile +++ b/alpine/Dockerfile @@ -18,7 +18,7 @@ ARG ENABLE_PROXY=false # Build Apache APISIX -FROM api7/apisix-base:1.19.9.1.3 +FROM api7/apisix-base:1.19.9.1.4 ARG APISIX_VERSION=2.12.1 LABEL apisix_version="${APISIX_VERSION}"
[apisix] branch master updated (6bb9fea -> 5279c98)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 6bb9fea test: make plugin/log-rotate2.t stable (#6654) add 5279c98 docs: unify zh/*.md grammar (#6642) No new revisions were added by this update. Summary of changes: docs/zh/latest/admin-api.md| 2 +- docs/zh/latest/plugins/api-breaker.md | 2 +- docs/zh/latest/plugins/clickhouse-logger.md| 2 +- docs/zh/latest/plugins/error-log-logger.md | 2 +- docs/zh/latest/plugins/fault-injection.md | 2 +- docs/zh/latest/plugins/file-logger.md | 2 +- docs/zh/latest/plugins/google-cloud-logging.md | 2 +- docs/zh/latest/plugins/http-logger.md | 6 +++--- docs/zh/latest/plugins/limit-conn.md | 8 docs/zh/latest/plugins/limit-count.md | 2 +- docs/zh/latest/plugins/openid-connect.md | 2 +- docs/zh/latest/plugins/proxy-cache.md | 10 +- docs/zh/latest/plugins/proxy-mirror.md | 8 docs/zh/latest/plugins/redirect.md | 10 +- docs/zh/latest/plugins/response-rewrite.md | 2 +- docs/zh/latest/plugins/serverless.md | 2 +- docs/zh/latest/plugins/skywalking-logger.md| 2 +- docs/zh/latest/plugins/sls-logger.md | 2 +- docs/zh/latest/plugins/splunk-hec-logging.md | 2 +- docs/zh/latest/plugins/syslog.md | 2 +- docs/zh/latest/plugins/tcp-logger.md | 2 +- docs/zh/latest/plugins/udp-logger.md | 2 +- docs/zh/latest/plugins/uri-blocker.md | 2 +- 23 files changed, 39 insertions(+), 39 deletions(-)
[apisix] branch master updated: docs(Wasm): use official name (#6515)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 1a1e8aa docs(Wasm): use official name (#6515) 1a1e8aa is described below commit 1a1e8aa4ed3871cb4ee71135954057cc7b944f9a Author: 罗泽轩 AuthorDate: Sun Mar 6 10:57:42 2022 +0800 docs(Wasm): use official name (#6515) Like iOS, WebAssembly is often called as Wasm but not WASM. Signed-off-by: spacewander --- README.md| 6 +++--- docs/en/latest/wasm.md | 16 docs/zh/latest/README.md | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3209eff..ebf6a49 100644 --- a/README.md +++ b/README.md @@ -142,15 +142,15 @@ A/B testing, canary release, blue-green deployment, limit rate, defense against - **Highly scalable** - [Custom plugins](docs/en/latest/plugin-develop.md): Allows hooking of common phases, such as `rewrite`, `access`, `header filter`, `body filter` and `log`, also allows to hook the `balancer` stage. - [Plugin can be written in Java/Go/Python](docs/en/latest/external-plugin.md) - - [Plugin can be written with Proxy WASM SDK](docs/en/latest/wasm.md) + - [Plugin can be written with Proxy Wasm SDK](docs/en/latest/wasm.md) - Custom load balancing algorithms: You can use custom load balancing algorithms during the `balancer` phase. - Custom routing: Support users to implement routing algorithms themselves. - **Multi-Language support** - - Apache APISIX is a multi-language gateway for plugin development and provides support via `RPC` and `WASM`. + - Apache APISIX is a multi-language gateway for plugin development and provides support via `RPC` and `Wasm`. ![Multi Language Support into Apache APISIX](docs/assets/images/apisix-multi-lang-support.png) - The RPC way, is the current way. Developers can choose the language according to their needs and after starting an independent process with the RPC, it exchanges data with APISIX through local RPC communication. Till this moment, APISIX has support for [Java](https://github.com/apache/apisix-java-plugin-runner), [Golang](https://github.com/apache/apisix-go-plugin-runner), [Python](https://github.com/apache/apisix-python-plugin-runner) and Node.js. - - The WASM or WebAssembly, is an experimental way. APISIX can load and run WASM bytecode via APISIX [wasm plugin](https://github.com/apache/apisix/blob/master/docs/en/latest/wasm.md) written with the [Proxy WASM SDK](https://github.com/proxy-wasm/spec#sdks). Developers only need to write the code according to the SDK and then compile it into a WASM bytecode that runs on WASM VM with APISIX. + - The Wasm or WebAssembly, is an experimental way. APISIX can load and run Wasm bytecode via APISIX [wasm plugin](https://github.com/apache/apisix/blob/master/docs/en/latest/wasm.md) written with the [Proxy Wasm SDK](https://github.com/proxy-wasm/spec#sdks). Developers only need to write the code according to the SDK and then compile it into a Wasm bytecode that runs on Wasm VM with APISIX. - **Serverless** - [Lua functions](docs/en/latest/plugins/serverless.md): Invoke functions in each phase in APISIX. diff --git a/docs/en/latest/wasm.md b/docs/en/latest/wasm.md index 4d115e3..52089dd 100644 --- a/docs/en/latest/wasm.md +++ b/docs/en/latest/wasm.md @@ -1,5 +1,5 @@ --- -title: WASM +title: Wasm --- -APISIX supports WASM plugins written with [Proxy WASM SDK](https://github.com/proxy-wasm/spec#sdks). +APISIX supports Wasm plugins written with [Proxy Wasm SDK](https://github.com/proxy-wasm/spec#sdks). This plugin requires APISIX to run on [APISIX-OpenResty](../how-to-build.md#step-6-build-openresty-for-apache-apisix), and is under construction. Currently, only a few APIs are implemented. Please follow [wasm-nginx-module](https://github.com/api7/wasm-nginx-module) to know the progress. ## Programming model -The plugin supports the following concepts from Proxy WASM: +The plugin supports the following concepts from Proxy Wasm: ``` Wasm Virtual Machine @@ -45,10 +45,10 @@ The plugin supports the following concepts from Proxy WASM: └┘ ``` -* All plugins run in the same WASM VM, like the Lua plugin in the Lua VM +* All plugins run in the same Wasm VM, like the Lua plugin in the Lua VM * Each plugin has its own VMContext (the root ctx) * Each configured route/global rules has its own PluginContext (the plugin ctx). -For example, if we have a service configuring with WASM plugin, and two routes inherit from it, +For example, if we have a service configuring with Wasm plugin, and two routes inherit from it, there will be two plugin ctxs. * Each HTTP request which hits the configuration will have its own
[apisix] branch master updated: doc: add new QQ group (#6274)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new ba50e79 doc: add new QQ group (#6274) ba50e79 is described below commit ba50e79bfbed1427b0dc98a097a6990407c20b6a Author: tzssangglass AuthorDate: Wed Feb 9 18:19:35 2022 +0800 doc: add new QQ group (#6274) --- CONTRIBUTING.md | 2 +- README.md| 2 +- docs/zh/latest/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d528a60..152d590 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -137,5 +137,5 @@ If you have contributed to Apache APISIX, no matter it is a code contribution to ## Do you have questions about the source code? -- **QQ Group**: 578997126(recommended), 552030619 +- **QQ Group**: 781365357(recommended), 578997126, 552030619 - Join in `apisix` channel at [Apache Slack](http://s.apache.org/slack-invite). If the link is not working, find the latest one at [Apache INFRA WIKI](https://cwiki.apache.org/confluence/display/INFRA/Slack+Guest+Invites). diff --git a/README.md b/README.md index 951bbb9..27a0d08 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ The technical architecture of Apache APISIX: ## Community - Mailing List: Mail to dev-subscr...@apisix.apache.org, follow the reply to subscribe to the mailing list. -- QQ Group - 578997126 +- QQ Group - 781365357 - Slack Workspace - Please [subscribe the mailing list](https://apisix.apache.org/docs/general/subscribe-guide) then ask for invitation link - ![Twitter Follow](https://img.shields.io/twitter/follow/ApacheAPISIX?style=social) - follow and interact with us using hashtag `#ApacheAPISIX` - [bilibili video](https://space.bilibili.com/551921247) diff --git a/docs/zh/latest/README.md b/docs/zh/latest/README.md index 98f33c9..7e446bd 100644 --- a/docs/zh/latest/README.md +++ b/docs/zh/latest/README.md @@ -39,7 +39,7 @@ Apache APISIX 的技术架构如下图所示: ## 社区 - 邮件列表 - 发送任意内容到 dev-subscr...@apisix.apache.org 后,根据回复以订阅邮件列表。 -- QQ 群 - 578997126 +- QQ 群 - 781365357 - Slack - 请 [订阅邮件列表](https://apisix.apache.org/docs/general/subscribe-guide) 后发送邮件获取邀请链接 - ![Twitter Follow](https://img.shields.io/twitter/follow/ApacheAPISIX?style=social) - 使用标签 `#ApacheAPISIX` 关注我们并与我们互动。 - [哔哩哔哩](https://space.bilibili.com/551921247)
[apisix] branch master updated (e067d34 -> 6e8710f)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from e067d34 build: make uninstall related files of runtime (#6236) add 6e8710f docs: update document directory (#6210) No new revisions were added by this update. Summary of changes: docs/zh/latest/plugin-develop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[apisix] branch master updated (4d52c3e -> fadf5c2)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 4d52c3e feat: add CSRF plugin (#5727) add fadf5c2 docs: add CSRF plugin info to README (#6144) No new revisions were added by this update. Summary of changes: README.md| 1 + docs/zh/latest/README.md | 1 + 2 files changed, 2 insertions(+)
[apisix-python-plugin-runner] branch master updated: doc: Update NOTICE (#39)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-python-plugin-runner.git The following commit(s) were added to refs/heads/master by this push: new 63bc9ca doc: Update NOTICE (#39) 63bc9ca is described below commit 63bc9ca7d9483a6fe124a1819a1dd9c2feb21acc Author: hf400159 <97138894+hf400...@users.noreply.github.com> AuthorDate: Fri Jan 7 19:28:05 2022 +0800 doc: Update NOTICE (#39) --- NOTICE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE b/NOTICE index 66f2232..9de15e3 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Apache APISIX -Copyright 2021 The Apache Software Foundation +Copyright 2021-2022 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/).
[apisix] branch master updated: doc: Update NOTICE (#6038)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 18c316f doc: Update NOTICE (#6038) 18c316f is described below commit 18c316f8a00f6c125a92df09da95774d5f17f241 Author: hf400159 <97138894+hf400...@users.noreply.github.com> AuthorDate: Fri Jan 7 13:38:43 2022 +0800 doc: Update NOTICE (#6038) --- NOTICE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE b/NOTICE index 024c35e..13e98eb 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Apache APISIX -Copyright 2019-2021 The Apache Software Foundation +Copyright 2019-2022 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/).
[apisix] branch membphis/skywalking-0.6.0 created (now cb4b6a8)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch membphis/skywalking-0.6.0 in repository https://gitbox.apache.org/repos/asf/apisix.git. at cb4b6a8 chore: upgrade skywalking to `0.6.0` This branch includes the following new commits: new cb4b6a8 chore: upgrade skywalking to `0.6.0` The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[apisix] 01/01: chore: upgrade skywalking to `0.6.0`
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch membphis/skywalking-0.6.0 in repository https://gitbox.apache.org/repos/asf/apisix.git commit cb4b6a8c1e9d6215101072a190320214a9e497f3 Author: YuanSheng Wang AuthorDate: Fri Dec 31 09:00:42 2021 +0800 chore: upgrade skywalking to `0.6.0` --- rockspec/apisix-master-0.rockspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rockspec/apisix-master-0.rockspec b/rockspec/apisix-master-0.rockspec index d2186df..883cd42 100644 --- a/rockspec/apisix-master-0.rockspec +++ b/rockspec/apisix-master-0.rockspec @@ -55,7 +55,7 @@ dependencies = { "lua-resty-ipmatcher = 0.6.1", "lua-resty-kafka = 0.07", "lua-resty-logger-socket = 2.0-0", -"skywalking-nginx-lua = 0.5.0", +"skywalking-nginx-lua = 0.6.0", "base64 = 1.5-2", "binaryheap = 0.4", "dkjson = 2.5-2",
[apisix-java-plugin-runner] branch main updated (d5adbe0 -> 4e3279f)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git. from d5adbe0 docs: add zh Quick Start (#95) add 4e3279f chore: upgrade log4j2 to 2.17.0 (#101) No new revisions were added by this update. Summary of changes: pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[apisix] branch master updated: feat: upgrade luarocks to 3.8.0 which converts git:// to https:// (#5825)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 5cde5ae feat: upgrade luarocks to 3.8.0 which converts git:// to https:// (#5825) 5cde5ae is described below commit 5cde5ae0040f9fa7468dae12649276f07b0e9031 Author: 罗泽轩 AuthorDate: Sat Dec 18 08:29:57 2021 +0800 feat: upgrade luarocks to 3.8.0 which converts git:// to https:// (#5825) The Luarocks 2.x is already broken. --- .github/workflows/fuzzing-ci.yaml | 1 - Makefile | 8 ++-- ci/common.sh | 1 - ci/linux_apisix_current_luarocks_runner.sh | 2 -- ci/linux_apisix_master_luarocks_runner.sh | 2 -- docs/en/latest/FAQ.md | 3 +-- docs/zh/latest/FAQ.md | 4 +--- utils/linux-install-luarocks.sh| 9 + 8 files changed, 9 insertions(+), 21 deletions(-) diff --git a/.github/workflows/fuzzing-ci.yaml b/.github/workflows/fuzzing-ci.yaml index b23ec2d..bb132da 100644 --- a/.github/workflows/fuzzing-ci.yaml +++ b/.github/workflows/fuzzing-ci.yaml @@ -50,7 +50,6 @@ jobs: sudo apt-get install -y git openresty curl openresty-openssl111-dev unzip make gcc libldap2-dev ./utils/linux-install-luarocks.sh -git config --global url.https://github.com/.insteadOf git://github.com/ make deps make init make run diff --git a/Makefile b/Makefile index adcd64d..2b25def 100644 --- a/Makefile +++ b/Makefile @@ -155,12 +155,8 @@ deps: runtime $(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.OPENSSL_INCDIR $(addprefix $(ENV_OPENSSL_PREFIX), /include); \ $(ENV_LUAROCKS) install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local $(ENV_LUAROCKS_SERVER_OPT); \ else \ - $(call func_echo_warn_status, "WARNING: You're not using LuaRocks 3.x; please add the following items to your LuaRocks config file:"); \ - echo "variables = {"; \ - echo "OPENSSL_LIBDIR=$(addprefix $(ENV_OPENSSL_PREFIX), /lib)"; \ - echo "OPENSSL_INCDIR=$(addprefix $(ENV_OPENSSL_PREFIX), /include)"; \ - echo "}"; \ - $(ENV_LUAROCKS) install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local $(ENV_LUAROCKS_SERVER_OPT); \ + $(call func_echo_warn_status, "WARNING: You're not using LuaRocks 3.x; please remove the luarocks and reinstall it via https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh";); \ + exit 1; \ fi diff --git a/ci/common.sh b/ci/common.sh index ec8b7e6..612236e 100644 --- a/ci/common.sh +++ b/ci/common.sh @@ -26,7 +26,6 @@ export_or_prefix() { create_lua_deps() { echo "Create lua deps" -git config --global url.https://github.com/.insteadOf git://github.com/ make deps # maybe reopen this feature later # luarocks install luacov-coveralls --tree=deps --local > build.log 2>&1 || (cat build.log && exit 1) diff --git a/ci/linux_apisix_current_luarocks_runner.sh b/ci/linux_apisix_current_luarocks_runner.sh index 2682a4f..a143d47 100755 --- a/ci/linux_apisix_current_luarocks_runner.sh +++ b/ci/linux_apisix_current_luarocks_runner.sh @@ -32,8 +32,6 @@ script() { sudo rm -rf /usr/local/apisix -git config --global url.https://github.com/.insteadOf git://github.com/ - # install APISIX with local version sudo luarocks install rockspec/apisix-master-0.rockspec --only-deps > build.log 2>&1 || (cat build.log && exit 1) sudo luarocks make rockspec/apisix-master-0.rockspec > build.log 2>&1 || (cat build.log && exit 1) diff --git a/ci/linux_apisix_master_luarocks_runner.sh b/ci/linux_apisix_master_luarocks_runner.sh index ed3e58c..a75fdf6 100755 --- a/ci/linux_apisix_master_luarocks_runner.sh +++ b/ci/linux_apisix_master_luarocks_runner.sh @@ -36,8 +36,6 @@ script() { mkdir tmp && cd tmp cp -r ../utils ./ -git config --global url.https://github.com/.insteadOf git://github.com/ - # install APISIX by luarocks sudo luarocks install $APISIX_MAIN > build.log 2>&1 || (cat build.log && exit 1) cp ../bin/apisix /usr/local/bin/apisix diff --git a/docs/en/latest/FAQ.md b/docs/en/latest/FAQ.md index 8038b9c..9f56094 100644 --- a/docs/en/latest/FAQ.md +++ b/docs/en/latest/FAQ.md @@ -66,7 +66,6 @@ See more [etcd why](https://etcd.io/docs/latest/learning/why/#comparison-chart). There are two possibilities when encountering slow luarocks: 1. Server used for luarocks installation is blocked -2. There is a place between your net
[apisix] branch master updated (4855813 -> c3ba11f)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 4855813 docs(request-id): fix typo in request-id plugin documents. (#5832) add c3ba11f docs(logging): supplement the supported logging service (#5843) No new revisions were added by this update. Summary of changes: README.md| 2 +- docs/zh/latest/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
[apisix] branch master updated: docs(request-id): fix typo in request-id plugin documents. (#5832)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 4855813 docs(request-id): fix typo in request-id plugin documents. (#5832) 4855813 is described below commit 4855813e617f15594e8b2fd47514a424759c8d35 Author: Carl Chen AuthorDate: Fri Dec 17 11:39:16 2021 +0800 docs(request-id): fix typo in request-id plugin documents. (#5832) --- docs/en/latest/plugins/request-id.md | 4 ++-- docs/zh/latest/plugins/request-id.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/en/latest/plugins/request-id.md b/docs/en/latest/plugins/request-id.md index 871c542..7a29ade 100644 --- a/docs/en/latest/plugins/request-id.md +++ b/docs/en/latest/plugins/request-id.md @@ -105,7 +105,7 @@ plugin_attr: - `snowflake_epoc` default start time is `2021-01-01T00:00:00Z`, and it can support `69 year` approximately to `2090-09-0715:47:35Z` according to the default configuration - `data_machine_bits` corresponds to the set of workIDs and datacEnteridd in the snowflake definition. The plug-in aslocates a unique ID to each process. Maximum number of supported processes is `pow(2, data_machine_bits)`. The default number of `12 bits` is up to `4096`. -- `sequence_bits` defaults to `10 bits` and each process generates up to `1024` ID per second +- `sequence_bits` defaults to `10 bits` and each process generates up to `1024` ID per millisecond. example @@ -115,7 +115,7 @@ plugin_attr: > - Start time 2014-10-20 T15:00:00.000z, accurate to milliseconds. It can > last about 69 years > - supports up to `1024` processes -> - Up to `4096` ID per second per process +> - Up to `4096` ID per millisecond per process ```yaml plugin_attr: diff --git a/docs/zh/latest/plugins/request-id.md b/docs/zh/latest/plugins/request-id.md index 5cbc42c..87ab863 100644 --- a/docs/zh/latest/plugins/request-id.md +++ b/docs/zh/latest/plugins/request-id.md @@ -104,7 +104,7 @@ plugin_attr: - snowflake_epoc 默认起始时间为 `2021-01-01T00:00:00Z`, 按默认配置可以支持 `69年` 大约可以使用到 `2090-09-07 15:47:35Z` - data_machine_bits 对应的是 snowflake 定义中的 WorkerID 和 DatacenterID 的集合,插件会为每一个进程分配一个唯一ID,最大支持进程数为 `pow(2, data_machine_bits)`。默认占 `12 bits` 最多支持 `4096` 个进程。 -- sequence_bits 默认占 `10 bits`, 每个进程每秒最多生成 `1024` 个ID +- sequence_bits 默认占 `10 bits`, 每个进程每毫秒最多生成 `1024` 个ID 配置示例 @@ -114,7 +114,7 @@ plugin_attr: > - 起始时间 2014-10-20T15:00:00.000Z, 精确到毫秒为单位。大约可以使用 `69年` > - 最多支持 `1024` 个进程 -> - 每个进程每秒最多产生 `4096` 个ID +> - 每个进程每毫秒最多产生 `4096` 个ID ```yaml plugin_attr:
[apisix] branch master updated: chore: bump lua-resty-rocketmq to 0.3.0-0 (#5774)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 4525437 chore: bump lua-resty-rocketmq to 0.3.0-0 (#5774) 4525437 is described below commit 4525437880f8342560bbfbfe8711c504f7b47584 Author: yuz10 <845238...@qq.com> AuthorDate: Sun Dec 12 17:20:46 2021 +0800 chore: bump lua-resty-rocketmq to 0.3.0-0 (#5774) --- rockspec/apisix-master-0.rockspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rockspec/apisix-master-0.rockspec b/rockspec/apisix-master-0.rockspec index 2c4ddf5..d2186df 100644 --- a/rockspec/apisix-master-0.rockspec +++ b/rockspec/apisix-master-0.rockspec @@ -72,7 +72,7 @@ dependencies = { "api7-snowflake = 2.0-1", "inspect == 3.1.1", "lualdap = 1.2.6-1", -"lua-resty-rocketmq = 0.2.1-3", +"lua-resty-rocketmq = 0.3.0-0", } build = {
[apisix] branch master updated: chore: delete expired inspiration statements (#5716)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 5f50216 chore: delete expired inspiration statements (#5716) 5f50216 is described below commit 5f5021649ead293eaad41ccddc95fa9d3f5006b7 Author: tzssangglass AuthorDate: Tue Dec 7 18:44:31 2021 -0600 chore: delete expired inspiration statements (#5716) --- apisix/core/response.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/apisix/core/response.lua b/apisix/core/response.lua index 9ce9c40..221c184 100644 --- a/apisix/core/response.lua +++ b/apisix/core/response.lua @@ -164,8 +164,6 @@ end -- final_body = transform(final_body) -- ngx.arg[1] = final_body -- ... --- --- Inspired by kong.response.get_raw_body() function _M.hold_body_chunk(ctx, hold_the_copy) local body_buffer local chunk, eof = arg[1], arg[2]
[apisix] branch master updated: feat: Apache OpenWhisk plugin (#5518)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 4f02605 feat: Apache OpenWhisk plugin (#5518) 4f02605 is described below commit 4f02605f3f0230847bbf96f3699e764371ba213f Author: Zeping Bai AuthorDate: Thu Nov 25 16:53:28 2021 +0800 feat: Apache OpenWhisk plugin (#5518) --- apisix/core/request.lua | 3 + apisix/plugins/openwhisk.lua| 114 + ci/linux-ci-init-service.sh | 6 + conf/config-default.yaml| 1 + docs/en/latest/config.json | 3 +- docs/en/latest/plugins/openwhisk.md | 98 +++ t/admin/plugins.t | 2 +- t/core/request.t| 27 t/plugin/openwhisk.t| 245 9 files changed, 497 insertions(+), 2 deletions(-) diff --git a/apisix/core/request.lua b/apisix/core/request.lua index 18d9978..95d84b9 100644 --- a/apisix/core/request.lua +++ b/apisix/core/request.lua @@ -273,4 +273,7 @@ function _M.get_http_version() return ngx.req.http_version() end + +_M.get_method = ngx.req.get_method + return _M diff --git a/apisix/plugins/openwhisk.lua b/apisix/plugins/openwhisk.lua new file mode 100644 index 000..a8fe8c2 --- /dev/null +++ b/apisix/plugins/openwhisk.lua @@ -0,0 +1,114 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +local core = require("apisix.core") +local http = require("resty.http") +local ngx_encode_base64 = ngx.encode_base64 +local tostring = tostring + +local schema = { +type = "object", +properties = { +api_host = {type = "string"}, +ssl_verify = { +type = "boolean", +default = true, +}, +service_token = {type = "string"}, +namespace = {type = "string", maxLength = 256}, +action = {type = "string", maxLength = 256}, +result = { +type = "boolean", +default = true, +}, +timeout = { +type = "integer", +minimum = 1, +maximum = 6, +default = 3000, +description = "timeout in milliseconds", +}, +keepalive = {type = "boolean", default = true}, +keepalive_timeout = {type = "integer", minimum = 1000, default = 6}, +keepalive_pool = {type = "integer", minimum = 1, default = 5} +}, +required = {"api_host", "service_token", "namespace", "action"} +} + + +local _M = { +version = 0.1, +priority = -1901, +name = "openwhisk", +schema = schema, +} + + +function _M.check_schema(conf) +local ok, err = core.schema.check(schema, conf) +if not ok then +return false, err +end + +return true +end + + +function _M.access(conf, ctx) +local params = { +method = "POST", +body = core.request.get_body(), +query = { +blocking = "true", +result = tostring(conf.result), +timeout = conf.timeout +}, +headers = { +["Authorization"] = "Basic " .. ngx_encode_base64(conf.service_token), +["Content-Type"] = "application/json", +}, +keepalive = conf.keepalive, +ssl_verify = conf.ssl_verify +} + +if conf.keepalive then +params.keepalive_timeout = conf.keepalive_timeout +params.keepalive_pool = conf.keepalive_pool +end + +-- OpenWhisk action endpoint +local endpoint = conf.api_host .. "/api/v1/namespaces/" .. conf.namespace .. +"/actions/" .. conf.action + +local httpc = http.new() +httpc:set_timeout(conf.timeout) + +local res, err = httpc:request_uri(endpoint, params) + +if not res or err then +
[apisix] branch master updated: ci(bug): Improve DNS settings (#5601)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 783b387 ci(bug): Improve DNS settings (#5601) 783b387 is described below commit 783b387f8167a52d5df8fa02c46d72fcab9b506c Author: Zeping Bai AuthorDate: Thu Nov 25 15:20:43 2021 +0800 ci(bug): Improve DNS settings (#5601) CentOS docker: use `--dns` parameter Ubuntu: use `netplan` --- .github/workflows/centos7-ci.yml | 2 +- utils/set-dns.sh | 20 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/centos7-ci.yml b/.github/workflows/centos7-ci.yml index 5f9f6ec..db5ad0b 100644 --- a/.github/workflows/centos7-ci.yml +++ b/.github/workflows/centos7-ci.yml @@ -57,7 +57,7 @@ jobs: - name: Run centos7 docker and mapping apisix into container run: | -docker run -itd -v /home/runner/work/apisix/apisix:/apisix --name centos7Instance --net="host" docker.io/centos:7 /bin/bash +docker run -itd -v /home/runner/work/apisix/apisix:/apisix --name centos7Instance --net="host" --dns 8.8.8.8 --dns-search apache.org docker.io/centos:7 /bin/bash # docker exec centos7Instance bash -c "cp -r /tmp/apisix ./" - name: Run other docker containers for test diff --git a/utils/set-dns.sh b/utils/set-dns.sh index 53970a7..2c7689d 100755 --- a/utils/set-dns.sh +++ b/utils/set-dns.sh @@ -25,8 +25,24 @@ echo "127.0.0.1 test.com" | sudo tee -a /etc/hosts echo "127.0.0.1 admin.apisix.dev" | sudo tee -a /etc/hosts cat /etc/hosts # check GitHub Action's configuration -echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf -echo "search apache.org" | sudo tee -a /etc/resolv.conf +# override DNS configures +if [ -f "/etc/netplan/50-cloud-init.yaml" ]; then +sudo pip3 install yq + +tmp=$(mktemp) +yq -y '.network.ethernets.eth0."dhcp4-overrides"."use-dns"=false' /etc/netplan/50-cloud-init.yaml | \ +yq -y '.network.ethernets.eth0."dhcp4-overrides"."use-domains"=false' | \ +yq -y '.network.ethernets.eth0.nameservers.addresses[0]="8.8.8.8"' | \ +yq -y '.network.ethernets.eth0.nameservers.search[0]="apache.org"' > $tmp +mv $tmp /etc/netplan/50-cloud-init.yaml +cat /etc/netplan/50-cloud-init.yaml +sudo netplan apply +sleep 3 + +sudo mv /etc/resolv.conf /etc/resolv.conf.bak +sudo ln -s /run/systemd/resolve/resolv.conf /etc/ +fi +cat /etc/resolv.conf mkdir -p build-cache
[apisix] branch master updated: feat(plugin): azure serverless functions (#5479)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 3a6a4db feat(plugin): azure serverless functions (#5479) 3a6a4db is described below commit 3a6a4db281658e5b9b832332a62e2893f0e57280 Author: Bisakh AuthorDate: Fri Nov 19 08:01:20 2021 +0530 feat(plugin): azure serverless functions (#5479) Co-authored-by: 罗泽轩 --- apisix/plugins/azure-functions.lua| 137 +++ conf/config-default.yaml | 1 + docs/en/latest/config.json| 3 +- docs/en/latest/plugins/azure-functions.md | 140 +++ t/admin/plugins.t | 2 +- t/lib/test_admin.lua | 6 +- t/plugin/azure-functions.t| 377 ++ 7 files changed, 661 insertions(+), 5 deletions(-) diff --git a/apisix/plugins/azure-functions.lua b/apisix/plugins/azure-functions.lua new file mode 100644 index 000..1597f2a --- /dev/null +++ b/apisix/plugins/azure-functions.lua @@ -0,0 +1,137 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. + +local core = require("apisix.core") +local http = require("resty.http") +local plugin = require("apisix.plugin") +local ngx = ngx +local plugin_name = "azure-functions" + +local schema = { +type = "object", +properties = { +function_uri = {type = "string"}, +authorization = { +type = "object", +properties = { +apikey = {type = "string"}, +clientid = {type = "string"} +} +}, +timeout = {type = "integer", minimum = 100, default = 3000}, +ssl_verify = {type = "boolean", default = true}, +keepalive = {type = "boolean", default = true}, +keepalive_timeout = {type = "integer", minimum = 1000, default = 6}, +keepalive_pool = {type = "integer", minimum = 1, default = 5} +}, +required = {"function_uri"} +} + +local metadata_schema = { +type = "object", +properties = { +master_apikey = {type = "string", default = ""}, +master_clientid = {type = "string", default = ""} +} +} + +local _M = { +version = 0.1, +priority = -1900, +name = plugin_name, +schema = schema, +metadata_schema = metadata_schema +} + +function _M.check_schema(conf, schema_type) +if schema_type == core.schema.TYPE_METADATA then +return core.schema.check(metadata_schema, conf) +end +return core.schema.check(schema, conf) +end + +function _M.access(conf, ctx) +local uri_args = core.request.get_uri_args(ctx) +local headers = core.request.headers(ctx) or {} +local req_body, err = core.request.get_body() + +if err then +core.log.error("error while reading request body: ", err) +return 400 +end + +-- set authorization headers if not already set by the client +-- we are following not to overwrite the authz keys +if not headers["x-functions-key"] and +not headers["x-functions-clientid"] then +if conf.authorization then +headers["x-functions-key"] = conf.authorization.apikey +headers["x-functions-clientid"] = conf.authorization.clientid +else +-- If neither api keys are set with the client request nor inside the plugin attributes +-- plugin will fallback to the master key (if any) present inside the metadata. +local metadata = plugin.plugin_metadata(plugin_name) +if metadata then +headers["x-functions-key"] = metadata.value.master_apikey +headers["x-functions-clientid"] = metadata.value.master_clientid +end +end +end + +headers["host"] = nil +local par
[apisix] branch master updated: fix: response.set_header can remove header like request.set_header (#5499)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 6c5108f fix: response.set_header can remove header like request.set_header (#5499) 6c5108f is described below commit 6c5108ff3896b96e1bf0a0a68fd2e7a9aadc1162 Author: 罗泽轩 AuthorDate: Sun Nov 14 15:08:55 2021 +0800 fix: response.set_header can remove header like request.set_header (#5499) Signed-off-by: spacewander --- apisix/core/response.lua | 4 +++- t/core/response.t| 21 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/apisix/core/response.lua b/apisix/core/response.lua index e1f0f4d..9ce9c40 100644 --- a/apisix/core/response.lua +++ b/apisix/core/response.lua @@ -101,7 +101,9 @@ local function set_header(append, ...) if count == 1 then local headers = select(1, ...) if type(headers) ~= "table" then -error("should be a table if only one argument", 2) +-- response.set_header(name, nil) +ngx_header[headers] = nil +return end for k, v in pairs(headers) do diff --git a/t/core/response.t b/t/core/response.t index eb8eda8..ed7856b 100644 --- a/t/core/response.t +++ b/t/core/response.t @@ -142,3 +142,24 @@ aaa: bbb, bbb ccc: ddd --- no_error_log [error] + + + +=== TEST 7: delete header +--- config +location = /t { +access_by_lua_block { +local core = require("apisix.core") +core.response.set_header("aaa", "bbb") +core.response.set_header("aaa", nil) +core.response.exit(200, "done\n") +} +} +--- request +GET /t +--- response_body +done +--- response_headers +aaa: +--- no_error_log +[error]
[apisix] branch master updated: test: make fuzzing-ci pass again (#4510)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 047f5e7 test: make fuzzing-ci pass again (#4510) 047f5e7 is described below commit 047f5e7d503ea62eba28bae7386efb3e6d5b8268 Author: 罗泽轩 AuthorDate: Thu Jul 1 12:28:31 2021 +0800 test: make fuzzing-ci pass again (#4510) --- .github/workflows/fuzzing-ci.yaml | 2 +- .gitignore| 1 + t/fuzzing/requirements.txt| 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fuzzing-ci.yaml b/.github/workflows/fuzzing-ci.yaml index de15b7b..7b4bf53 100644 --- a/.github/workflows/fuzzing-ci.yaml +++ b/.github/workflows/fuzzing-ci.yaml @@ -65,7 +65,7 @@ jobs: - name: install boofuzz run: | -pip install typing boofuzz +pip install -r $PWD/t/fuzzing/requirements.txt - name: run simpleroute test run: | diff --git a/.gitignore b/.gitignore index 92d7722..1dea8b5 100644 --- a/.gitignore +++ b/.gitignore @@ -71,6 +71,7 @@ ci/openwhisk-utilities/ !/conf/config-default.yaml /conf/debug-*.yaml /build-cache/ +t/fuzzing/__pycache__/ # release tar package *.tgz release/* diff --git a/t/fuzzing/requirements.txt b/t/fuzzing/requirements.txt new file mode 100644 index 000..9113b81 --- /dev/null +++ b/t/fuzzing/requirements.txt @@ -0,0 +1,3 @@ +typing==3.7.4.3 +# boofuzz 0.4.0 only supports Python 3.6+ +boofuzz==0.3.0
[apisix-website] branch master updated: docs: added etcd3 support HTTP access perfectly blog (#396)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-website.git The following commit(s) were added to refs/heads/master by this push: new d031a7a docs: added etcd3 support HTTP access perfectly blog (#396) d031a7a is described below commit d031a7a5a3e1e94788530e8366b593cab0060aea Author: Serendipity96 AuthorDate: Wed Jun 30 16:24:50 2021 +0800 docs: added etcd3 support HTTP access perfectly blog (#396) --- ...21-06-30-etcd3-support-HTTP-access-perfectly.md | 96 + website/static/img/blog_img/2021-06-30-1.png | Bin 0 -> 48 bytes website/static/img/blog_img/2021-06-30-2.png | Bin 0 -> 199227 bytes 3 files changed, 96 insertions(+) diff --git a/website/blog/2021-06-30-etcd3-support-HTTP-access-perfectly.md b/website/blog/2021-06-30-etcd3-support-HTTP-access-perfectly.md new file mode 100644 index 000..236dc49 --- /dev/null +++ b/website/blog/2021-06-30-etcd3-support-HTTP-access-perfectly.md @@ -0,0 +1,96 @@ +--- +title: "差之毫厘:etcd 3 完美支持 HTTP 访问?" +author: spacewander +authorURL: "https://github.com/spacewander"; +authorImageURL: "https://avatars.githubusercontent.com/u/4161644?v=4"; +--- +> [@spacewander](https://github.com/spacewander), Core developer of Apache APISIX from [Shenzhen Zhiliu Technology Co.](https://www.apiseven.com/) +> + + +etcd 升级到 3.x 版本后,其对外 API 的协议从普通的 HTTP1 切换到了 gRPC。为了兼顾那些不能使用 gRPC 的特殊群体,etcd 通过 gRPC-gateway 的方式代理 HTTP1 请求,以 gRPC 形式去访问新的 gRPC API。(由于 HTTP1 念起来太过拗口,以下将之简化成 HTTP,正好和 gRPC 能够对应。请不要纠结 gRPC 也是 HTTP 请求的这种问题。) + +Apache APISIX 开始用 etcd 的时候,用的是 etcd v2 的 API。从 Apache APISIX 2.0 版本起,我们把依赖的 etcd 版本升级到 3.x。由于 Lua 生态圈里面没有 gRPC 库,所以 etcd 对 HTTP 的兼容帮了我们很大的忙,这样就不用花很大心思去补这个短板了。 + +从去年 10 月发布 Apache APISIX 2.0 版本以来,现在已经过去了 8 个月。在实践过程中,我们也发现了 etcd 的 HTTP API 的一些跟 gRPC API 交互的问题。事实上,拥有 gRPC-gateway 并不意味着能够完美支持 HTTP 访问,这里还是有些细微的差别。 + +### 打破 gRPC 的默认限制 + +就在几天前,etcd 发布了 v3.5.0 版本。这个版本的发布,了却困扰我们很长时间的一个问题。 + +跟 HTTP 不同的是,gRPC 默认限制了一次请求可以读取的数据大小。这个限制叫做 “MaxCallRecvMsgSize”,默认是 4MiB。当 Apache APISIX 全量同步 etcd 数据时,假如配置够多,就会触发这一上限,报错 “grpc: received message larger than max”。 + +神奇的是,如果你用 etcdctl 去访问,这时候却不会有任何问题。这是因为这个限制是可以在跟 gRPC server 建立连接时动态设置的,etcdctl 给这个限制设置了一个很大的整数,相当于去掉了这一限制。 + +由于不少用户碰到过同样的问题,我们曾经讨论过对策。 + +一个想法是用增量同步模拟全量同步,这么做有两个弊端: + +1. 实现起来复杂,要改不少代码 +2. 会延长同步所需的时间 + +另一个想法是修改 etcd。既然能够在 etcdctl 里面去除限制,为什么不对 gRPC-gateway 一视同仁呢?同样的改动可以作用在 gRPC-gateway 上。 + +我们采用了第二种方案,给 etcd 提了个 PR:https://github.com/etcd-io/etcd/pull/13077 + +![2021-06-30-1](../static/img/blog_img/2021-06-30-1.png) + +最新发布的 v3.5.0 版本就包含了我们贡献的这个改动。如果你遇到 “grpc: received message larger than max”,不妨试一下这个版本。这一改动也被 etcd 开发者 backport 到 3.4 分支上了。3.4 分支的下一个发布,也会带上这个改动。 + +这件事也说明 gRPC-gateway 并非百试百灵。即使用了它,也不能保证 HTTP 访问能够跟 gRPC 访问有一样的体验。 + +### 对服务端证书的有趣用法 + +Apache APISIX 增加了对 etcd mTLS 的支持后,有用户反馈一直没法完成校验,而用 etcdctl 访问则是成功的。在跟用户交流后,我决定拿他的证书来复现下。 + +在复现过程中,我注意到 etcd 日志里面有这样的报错: + +``` text +2021-06-09 11:10:13.022735 I | embed: rejected connection from "127.0.0.1:50898" (error "tls: failed to verify client's certificate: x509: certificate specifies an incompatible key usage", ServerName "") +WARNING: 2021/06/09 11:10:13 grpc: addrConn.createTransport failed to connect to {127.0.0.1:12379 0 }. Err :connection error: desc = "transport: authentication handshake failed: remote error: tls: bad certificate". Reconnecting... +``` + +“bad certificate” 错误信息,初看像是因为我们发给 etcd 的客户端证书不对。但仔细瞧瞧,会发现这个报错是在 gRPC server 里面报的。 + +gRPC-gateway 在 etcd 里面起到一个代理的作用,把外面的 HTTP 请求变成 gRPC server 能处理的 gRPC 请求。 + +大体架构如下: + +```text +etcdctl > gRPC server +Apache APISIX ---> gRPC-gateway ---> gRPC server +``` + +为什么 etcdctl 直连 gRPC server 能通,而中间加一层 gRPC-gateway 就不行? + +原来当 etcd 启用了客户端证书校验之后,用 gRPC-gateway 连接 gRPC server 就需要提供一个客户端证书。猜猜这个证书从哪来? + +etcd 把配置的服务端证书直接作为这里的客户端证书用了。 + +一个证书既在服务端上提供验证,又在客户端上表明身份,看上去也没什么问题。除非…… + +除非证书上启用了 server auth 的拓展,但是没有启用 client auth。 + +对有问题的证书执行`openssl x509 -text -noout -in /tmp/bad.crt` + +会看到这样的输出: + +```text +X509v3 extensions: +X509v3 Key Usage: critical +Digital Signature, Key Encipherment +X509v3 Extended Key Usage: +TLS Web Server Authentication +``` + +注意这里的 “TLS Web Server Authentication”,如果我们把它改成 “TLS Web Server Authentication, TLS Web Client Authentication”,抑或不加这个拓展,就没有问题了。 + +etcd 上也有关于这个问题的 issue:https://github.com/etcd-io/etcd/issues/9785 + +![2021-06-30-2](../static/img/blog_img/2021-06-30-2.png) + +### 结语 + +虽然我们在上文列出了几点小问题,但是瑕不掩瑜,etcd 对 HTTP 访问的支持还是一个非常有用的特性。 + +感谢 Apache APISIX 的用户们,正是因为我们有着广阔的用户群,才能发现 etcd 的这些细节上的问题。我们作为 etcd 的一大用户,在之后的日子里也将一如既往地跟 etcd 的开发者多多交流。 diff --git a/website/static/img/blog_img/2021-06-30-1.png b/website/static/img/blog_img/2021-06-30-1.png new file mode 100644 index 000..c0a18f4 Binary files /dev/null and b/website/static/img/blog_img/2021-06-30-1.png differ diff --git a/website/st
[apisix] branch master updated: docs: use mockbin to view http logs for guidance (#4427)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new bf90cbe docs: use mockbin to view http logs for guidance (#4427) bf90cbe is described below commit bf90cbe81e601591953b9a04166bdc86b50118d8 Author: Shuyang Wu AuthorDate: Fri Jun 18 06:23:37 2021 -0400 docs: use mockbin to view http logs for guidance (#4427) Co-authored-by: 罗泽轩 --- docs/en/latest/plugins/http-logger.md | 4 ++-- docs/zh/latest/plugins/http-logger.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/en/latest/plugins/http-logger.md b/docs/en/latest/plugins/http-logger.md index 84bc743..104452c 100644 --- a/docs/en/latest/plugins/http-logger.md +++ b/docs/en/latest/plugins/http-logger.md @@ -54,14 +54,14 @@ This will provide the ability to send Log data requests as JSON objects to Monit ## How To Enable -The following is an example on how to enable the http-logger for a specific route. +The following is an example of how to enable the `http-logger` for a specific route. You could generate a mock HTTP server at [mockbin](http://mockbin.org/bin/create) to view the logs. ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "plugins": { "http-logger": { -"uri": "http://127.0.0.1:80/postendpoint?param=1"; +"uri": "http://mockbin.org/bin/:ID"; } }, "upstream": { diff --git a/docs/zh/latest/plugins/http-logger.md b/docs/zh/latest/plugins/http-logger.md index 3120177..811c9d0 100644 --- a/docs/zh/latest/plugins/http-logger.md +++ b/docs/zh/latest/plugins/http-logger.md @@ -54,14 +54,14 @@ title: http-logger ## 如何开启 -这是有关如何为特定路由启用 http-logger 插件的示例。 +这是有关如何为特定路由启用 `http-logger` 插件的示例。你可以在 [mockbin](http://mockbin.org/bin/create) 生成一个模拟 HTTP 服务器来浏览生成的日志 ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "plugins": { "http-logger": { -"uri": "http://127.0.0.1:80/postendpoint?param=1"; +"uri": "http://mockbin.org/bin/:ID"; } }, "upstream": {
[apisix] branch master updated: chore(deps): bump actions/upload-artifact from 2.2.3 to 2.2.4 (#4438)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new af385a5 chore(deps): bump actions/upload-artifact from 2.2.3 to 2.2.4 (#4438) af385a5 is described below commit af385a5659cafbeabf4925c3939a6fd9a566114b Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> AuthorDate: Fri Jun 18 18:22:35 2021 +0800 chore(deps): bump actions/upload-artifact from 2.2.3 to 2.2.4 (#4438) --- .github/workflows/build.yml | 2 +- .github/workflows/centos7-ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a6c3437..8fb0b27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -162,7 +162,7 @@ jobs: - name: Publish Artifact if: ${{ startsWith(github.ref, 'refs/heads/release/') && matrix.os_name == 'linux_openresty' }} -uses: actions/upload-artifact@v2.2.3 +uses: actions/upload-artifact@v2.2.4 with: name: ${{ steps.branch_env.outputs.fullname }} path: ${{ steps.branch_env.outputs.fullname }} diff --git a/.github/workflows/centos7-ci.yml b/.github/workflows/centos7-ci.yml index 4c5bb3e..dc533b0 100644 --- a/.github/workflows/centos7-ci.yml +++ b/.github/workflows/centos7-ci.yml @@ -111,7 +111,7 @@ jobs: - name: Publish Artifact if: ${{ startsWith(github.ref, 'refs/heads/release/') }} - uses: actions/upload-artifact@v2.2.3 + uses: actions/upload-artifact@v2.2.4 with: name: "rpm" path: "./apisix-build-tools/output/apisix-${{ steps.branch_env.outputs.version }}-0.x86_64.rpm"
[apisix] branch master updated: refactor: avoid repeating the host regex pattern (#4424)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new b9e14c8 refactor: avoid repeating the host regex pattern (#4424) b9e14c8 is described below commit b9e14c84a906356b168452fe807f139705d9cf1f Author: 罗泽轩 AuthorDate: Tue Jun 15 19:44:21 2021 +0800 refactor: avoid repeating the host regex pattern (#4424) --- apisix/schema_def.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua index 9f8aaa2..cd860c6 100644 --- a/apisix/schema_def.lua +++ b/apisix/schema_def.lua @@ -645,13 +645,13 @@ _M.ssl = { key = private_key_schema, sni = { type = "string", -pattern = [[^\*?[0-9a-zA-Z-.]+$]], +pattern = host_def_pat, }, snis = { type = "array", items = { type = "string", -pattern = [[^\*?[0-9a-zA-Z-.]+$]], +pattern = host_def_pat, }, minItems = 1, },
[apisix] branch master updated: doc: fix capitalization and image alt attributes (#4008)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 17ae333 doc: fix capitalization and image alt attributes (#4008) 17ae333 is described below commit 17ae333df464c0e811ee538f3df7ef6ee9ef8601 Author: John Bampton AuthorDate: Thu May 6 15:37:35 2021 +1000 doc: fix capitalization and image alt attributes (#4008) Remove unneeded blank line --- CODE_STYLE.md| 2 +- LICENSE | 1 - README.md| 2 +- docs/es/latest/README.md | 2 +- docs/zh/latest/README.md | 2 +- kubernetes/README.md | 4 ++-- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CODE_STYLE.md b/CODE_STYLE.md index c20f73b..9543215 100644 --- a/CODE_STYLE.md +++ b/CODE_STYLE.md @@ -21,7 +21,7 @@ title: APISIX Lua Coding Style Guide # --> -## indentation +## Indentation Use 4 spaces as an indent: diff --git a/LICENSE b/LICENSE index 1e50066..0474b54 100644 --- a/LICENSE +++ b/LICENSE @@ -216,4 +216,3 @@ The following components are provided under the Apache License. See project link The text of each license is the standard Apache 2.0 license. ewma.lua file from kubernetes/ingress-nginx: https://github.com/kubernetes/ingress-nginx Apache 2.0 - diff --git a/README.md b/README.md index 8272281..f85b6d7 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ It can also be used as a [k8s ingress controller](https://github.com/apache/apis The technical architecture of Apache APISIX: -![](docs/assets/images/apisix.png) +![Technical architecture of Apache APISIX](docs/assets/images/apisix.png) ## Community diff --git a/docs/es/latest/README.md b/docs/es/latest/README.md index bdbedc6..975bc7c 100644 --- a/docs/es/latest/README.md +++ b/docs/es/latest/README.md @@ -36,7 +36,7 @@ También puede usarse como [k8s ingress controller (control de ingreso)](https:/ La arquitectura técnica de Apache APISIX: -![](../../assets/images/apisix.png) +![La arquitectura técnica de Apache APISIX](../../assets/images/apisix.png) ## Communidad diff --git a/docs/zh/latest/README.md b/docs/zh/latest/README.md index 641dcba..88f2718 100644 --- a/docs/zh/latest/README.md +++ b/docs/zh/latest/README.md @@ -34,7 +34,7 @@ title: Apache APISIX Apache APISIX 的技术架构如下图所示: -![](../../assets/images/apisix.png) +![Apache APISIX 的技术架构](../../assets/images/apisix.png) ## 社区 diff --git a/kubernetes/README.md b/kubernetes/README.md index 0afc71c..da88532 100644 --- a/kubernetes/README.md +++ b/kubernetes/README.md @@ -17,7 +17,7 @@ # --> -### kubernetes +### Kubernetes There are some yaml files for deploying apisix in Kubernetes. @@ -35,7 +35,7 @@ if you do not need to change any config, and use default config in `../conf/conf $ kubectl create configmap apisix-gw-config.yaml --from-file=../conf/config.yaml ``` - when using etcd-operator + When using etcd-operator when using etcd-operator, you need to change `apisix-gw-config-cm.yaml`:
[apisix-docker] branch master updated: docs: fix broken link in manual markdown page (#169)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-docker.git The following commit(s) were added to refs/heads/master by this push: new 5438ebe docs: fix broken link in manual markdown page (#169) 5438ebe is described below commit 5438ebec0532c1164b4a4d85df7a1ef37404eb2f Author: Kishani Kandasamy <53715187+kishanikandas...@users.noreply.github.com> AuthorDate: Wed May 5 14:52:19 2021 +0530 docs: fix broken link in manual markdown page (#169) --- docs/en/latest/manual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/latest/manual.md b/docs/en/latest/manual.md index 5760ada..ba49137 100644 --- a/docs/en/latest/manual.md +++ b/docs/en/latest/manual.md @@ -55,7 +55,7 @@ docker run -it --name etcd-server \ ### Run Apache APISIX server -You need etcd docker to work with Apache APISIX. You can refer to [the docker-compose example](example/README.md). +You need etcd docker to work with Apache APISIX. You can refer to [the docker-compose example](example.md). Or you can run APISIX with Docker directly(Docker name is test-api-gateway):
[apisix] branch master updated: feat: step 3, manage the plugin runner (#4163)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 624f59f feat: step 3, manage the plugin runner (#4163) 624f59f is described below commit 624f59fc78baf9eccc3987ee6bb12d9c0a3d0c43 Author: 罗泽轩 AuthorDate: Tue May 4 10:41:08 2021 +0800 feat: step 3, manage the plugin runner (#4163) * feat: step 3, manage the plugin runner * feat: step 4, add prepare_conf protocol --- apisix/cli/ngx_tpl.lua | 1 + apisix/constants.lua | 3 + apisix/init.lua| 1 + apisix/plugins/ext-plugin/init.lua | 201 ++--- conf/config-default.yaml | 3 + t/APISIX.pm| 1 + t/lib/ext-plugin.lua | 29 +- t/plugin/ext-plugin/runner.sh | 22 t/plugin/ext-plugin/sanity.t | 151 +++- 9 files changed, 396 insertions(+), 16 deletions(-) diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua index 7173a3a..5f935cd 100644 --- a/apisix/cli/ngx_tpl.lua +++ b/apisix/cli/ngx_tpl.lua @@ -47,6 +47,7 @@ worker_rlimit_core {* worker_rlimit_core *}; worker_shutdown_timeout {* worker_shutdown_timeout *}; env APISIX_PROFILE; +env PATH; # for searching external plugin runner's binary {% if envs then %} {% for _, name in ipairs(envs) do %} diff --git a/apisix/constants.lua b/apisix/constants.lua index c668959..8dac0cb 100644 --- a/apisix/constants.lua +++ b/apisix/constants.lua @@ -15,6 +15,9 @@ -- limitations under the License. -- return { +RPC_ERROR = 0, +RPC_PREPARE_CONF = 1, +RPC_HTTP_REQ_CALL = 2, HTTP_ETCD_DIRECTORY = { ["/upstreams"] = true, ["/plugins"] = true, diff --git a/apisix/init.lua b/apisix/init.lua index 6d8234b..4a30b77 100644 --- a/apisix/init.lua +++ b/apisix/init.lua @@ -127,6 +127,7 @@ function _M.http_init_worker() require("apisix.debug").init_worker() require("apisix.upstream").init_worker() +require("apisix.plugins.ext-plugin.init").init_worker() local_conf = core.config.local_conf() diff --git a/apisix/plugins/ext-plugin/init.lua b/apisix/plugins/ext-plugin/init.lua index 8901529..924e9f4 100644 --- a/apisix/plugins/ext-plugin/init.lua +++ b/apisix/plugins/ext-plugin/init.lua @@ -14,8 +14,20 @@ -- See the License for the specific language governing permissions and -- limitations under the License. -- +local is_http = ngx.config.subsystem == "http" +local flatbuffers = require("flatbuffers") +local prepare_conf_req = require("A6.PrepareConf.Req") +local prepare_conf_resp = require("A6.PrepareConf.Resp") +local text_entry = require("A6.TextEntry") +local constants = require("apisix.constants") local core = require("apisix.core") local helper = require("apisix.plugins.ext-plugin.helper") +local process, ngx_pipe, events +if is_http then +process = require("ngx.process") +ngx_pipe = require("ngx.pipe") +events = require("resty.worker.events") +end local bit = require("bit") local band = bit.band local lshift = bit.lshift @@ -25,6 +37,10 @@ local ffi_str = ffi.string local socket_tcp = ngx.socket.tcp local str_byte = string.byte local str_format = string.format +local ngx_timer_at = ngx.timer.at +local exiting = ngx.worker.exiting +local error = error +local events_list local lrucache = core.lrucache.new({ @@ -34,15 +50,40 @@ local lrucache = core.lrucache.new({ local schema = { type = "object", -properties = {}, +properties = { +conf = { +type = "array", +items = { +type = "object", +properties = { +name = { +type = "string", +maxLength = 128, +minLength = 1 +}, +value = { +type = "string", +}, +} +}, +minItems = 1, +}, +extra_info = { +type = "array", +items = { +type = "string", +maxLength = 64, +minLength = 1, +}, +minItems = 1, +} +}, } local _M = { schema = schema, } -local RPC_ERROR = 0 -local RPC_PREPARE_CONF = 1 -local RPC_HTTP_REQ_CALL = 2 +local builder = flatbuffers.Builder(0) local send @@ -86,7 +127,7 @@ local function receive(sock) end local ty = str_byte(hdr, 1) -if ty == RPC_ERROR then +if ty == constants.RPC_ERROR th
[apisix] branch master updated: feat: upstream grpcs support mTLS (#4070)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 12c9e6f feat: upstream grpcs support mTLS (#4070) 12c9e6f is described below commit 12c9e6f2670904c0daa19f47844dd61dae6496a5 Author: 罗泽轩 AuthorDate: Tue Apr 20 18:08:13 2021 +0800 feat: upstream grpcs support mTLS (#4070) --- apisix/init.lua | 62 ++--- apisix/upstream.lua | 24 -- ci/centos7-ci.sh| 7 +++-- ci/common.sh| 2 ++ ci/linux_openresty_common_runner.sh | 10 +++--- t/grpc-proxy-test.sh| 35 +++-- 6 files changed, 102 insertions(+), 38 deletions(-) diff --git a/apisix/init.lua b/apisix/init.lua index 70be796..24747fc 100644 --- a/apisix/init.lua +++ b/apisix/init.lua @@ -14,32 +14,33 @@ -- See the License for the specific language governing permissions and -- limitations under the License. -- -local require = require +local require = require require("apisix.patch").patch() -local core = require("apisix.core") -local plugin= require("apisix.plugin") -local plugin_config = require("apisix.plugin_config") -local script= require("apisix.script") -local service_fetch = require("apisix.http.service").get -local admin_init= require("apisix.admin.init") -local get_var = require("resty.ngxvar").fetch -local router= require("apisix.router") -local set_upstream = require("apisix.upstream").set_by_route -local upstream_util = require("apisix.utils.upstream") -local ctxdump = require("resty.ctxdump") -local ipmatcher = require("resty.ipmatcher") -local ngx = ngx -local get_method= ngx.req.get_method -local ngx_exit = ngx.exit -local math = math -local error = error -local ipairs= ipairs -local tostring = tostring -local ngx_now = ngx.now -local ngx_var = ngx.var -local str_byte = string.byte -local str_sub = string.sub -local tonumber = tonumber +local core= require("apisix.core") +local plugin = require("apisix.plugin") +local plugin_config = require("apisix.plugin_config") +local script = require("apisix.script") +local service_fetch = require("apisix.http.service").get +local admin_init = require("apisix.admin.init") +local get_var = require("resty.ngxvar").fetch +local router = require("apisix.router") +local apisix_upstream = require("apisix.upstream") +local set_upstream= apisix_upstream.set_by_route +local upstream_util = require("apisix.utils.upstream") +local ctxdump = require("resty.ctxdump") +local ipmatcher = require("resty.ipmatcher") +local ngx = ngx +local get_method = ngx.req.get_method +local ngx_exit= ngx.exit +local math= math +local error = error +local ipairs = ipairs +local tostring= tostring +local ngx_now = ngx.now +local ngx_var = ngx.var +local str_byte= string.byte +local str_sub = string.sub +local tonumber= tonumber local control_api_router if ngx.config.subsystem == "http" then control_api_router = require("apisix.control.router") @@ -488,6 +489,17 @@ end function _M.grpc_access_phase() ngx.ctx = ctxdump.apply_ngx_ctx(ngx_var.ctx_ref) + +local api_ctx = ngx.ctx.api_ctx +if not api_ctx then +return +end + +local code, err = apisix_upstream.set_grpcs_upstream_param(api_ctx) +if code then +core.log.error("failed to set grpcs upstream param: ", err) +core.response.exit(code) +end end diff --git a/apisix/upstream.lua b/apisix/upstream.lua index 5bcc679..488dfaf 100644 --- a/apisix/upstream.lua +++ b/apisix/upstream.lua @@ -291,7 +291,8 @@ function _M.set_by_route(route, api_ctx) api_ctx.up_checker = checker end -if up_conf.scheme == "https" and up_conf.tls then +local scheme = up_conf.scheme +if (scheme == "https" or scheme == "grpcs") and up_conf.tls then -- the sni here is just for logging local sni = api_ctx.var.upstream_host local cert, err = apisix_ssl.fetch_cert(sni, up_conf.tls.client_cert) @@ -304,13 +305,30 @@ function _M.set_by_route(route, api_ctx) return 503, err end +if scheme == "grpcs" then +api_ctx.upstream_grpcs_cert = cert +api_ctx.upstre
[apisix-dashboard] branch master updated: fix: online debug test case (#1761)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git The following commit(s) were added to refs/heads/master by this push: new 266c5f6 fix: online debug test case (#1761) 266c5f6 is described below commit 266c5f6b9c51cd1367ab1acf375d7df8b0be9c72 Author: 琚致远 AuthorDate: Tue Apr 13 17:20:35 2021 +0800 fix: online debug test case (#1761) --- web/cypress/integration/route/online-debug.spec.js | 44 +++--- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/web/cypress/integration/route/online-debug.spec.js b/web/cypress/integration/route/online-debug.spec.js index f5de8a4..eca9edd 100644 --- a/web/cypress/integration/route/online-debug.spec.js +++ b/web/cypress/integration/route/online-debug.spec.js @@ -110,7 +110,7 @@ context('Online debug', () => { // click send without type debugUrl cy.contains(routeLocaleUS['page.route.button.send']).click({ force: true }); cy.contains(routeLocaleUS['page.route.input.placeholder.requestUrl']).should('exist'); -cy.get(this.domSelector.notificationCloseIcon).click(); +cy.get(this.domSelector.notificationCloseIcon).click({ multiple: true }); // input invalid uris data.invalidUrls.forEach((uri) => { @@ -120,16 +120,18 @@ context('Online debug', () => { // should not show the notification about input the valid request url cy.contains(routeLocaleUS['page.route.input.placeholder.requestUrl']).should('exist'); - cy.get(this.domSelector.notificationCloseIcon).click(); + cy.get(this.domSelector.notificationCloseIcon).click({ multiple: true }); }); }); - it('should autocomplete header',function () { + it('should autocomplete header', function () { cy.visit('/'); cy.contains(menuLocaleUS['menu.routes']).click(); const currentToken = localStorage.getItem('token'); // show online debug draw +cy.get(this.domSelector.refresh).click(); +cy.contains('Advanced').click(); cy.contains(routeLocaleUS['page.route.onlineDebug']).click(); cy.get(domSelector.debugDraw).should('be.visible'); cy.get(domSelector.headerTab).should('be.visible').click(); @@ -199,7 +201,7 @@ context('Online debug', () => { cy.get(this.domSelector.drawerClose).click(); }); - it('should debug GET request with query parammeters and jwt auth successfully', function() { + it('should debug GET request with query parammeters and jwt auth successfully', function () { cy.visit('/'); cy.contains(menuLocaleUS['menu.routes']).click(); const currentToken = localStorage.getItem('token'); @@ -238,7 +240,7 @@ context('Online debug', () => { }); }); - it('should debug POST request with raw json successfully', function() { + it('should debug POST request with raw json successfully', function () { cy.visit('/'); cy.contains(menuLocaleUS['menu.routes']).click(); const currentToken = localStorage.getItem('token'); @@ -275,35 +277,35 @@ context('Online debug', () => { }); cy.wait('@DebugAPI'); cy.get(domSelector.codeMirrorResp).contains('code').should('be.visible'); - cy.get(domSelector.codeMirrorResp).within(() => { -cy.get('.cm-property').should(($property) => { - $property.map((i, el) => { -if (Cypress.$(el).text() === '"name"') { - const findRouteName = Cypress.$(el).next().text(); - expect(findRouteName).to.equal(`"${this.routeData.debugPostJson.name}"`); -} -if (Cypress.$(el).text() === '"data"') { - const data = Cypress.$(el).next().text(); - expect(data).to.not.equal('null'); -} - }) +cy.get(domSelector.codeMirrorResp).within(() => { + cy.get('.cm-property').should(($property) => { +$property.map((i, el) => { + if (Cypress.$(el).text() === '"name"') { +const findRouteName = Cypress.$(el).next().text(); + expect(findRouteName).to.equal(`"${this.routeData.debugPostJson.name}"`); + } + if (Cypress.$(el).text() === '"data"') { +const data = Cypress.$(el).next().text(); +expect(data).to.not.equal('null'); + } }) - }); + }) +}); }); - it('should delete routes create for test cases successfully', function() { + it('s
[apisix-helm-chart] branch master updated: docs: remove duplicate titles (#57)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git The following commit(s) were added to refs/heads/master by this push: new f39e5ed docs: remove duplicate titles (#57) f39e5ed is described below commit f39e5ede3162c211eee395c436674aa12ced0818 Author: Kishani Kandasamy <53715187+kishanikandas...@users.noreply.github.com> AuthorDate: Mon Apr 12 21:30:28 2021 +0530 docs: remove duplicate titles (#57) --- docs/en/latest/apisix-dashboard.md | 2 -- docs/en/latest/apisix-ingress-controller.md | 2 -- docs/en/latest/apisix.md| 2 -- 3 files changed, 6 deletions(-) diff --git a/docs/en/latest/apisix-dashboard.md b/docs/en/latest/apisix-dashboard.md index b759bc1..bd4c011 100644 --- a/docs/en/latest/apisix-dashboard.md +++ b/docs/en/latest/apisix-dashboard.md @@ -21,8 +21,6 @@ title: Apache APISIX Dashboard Helm Chart # --> -# Apache APISIX Dashboard Helm Chart - ## Install To install the chart with release name `apisix-dashboard`: diff --git a/docs/en/latest/apisix-ingress-controller.md b/docs/en/latest/apisix-ingress-controller.md index 0de855a..8893596 100644 --- a/docs/en/latest/apisix-ingress-controller.md +++ b/docs/en/latest/apisix-ingress-controller.md @@ -21,8 +21,6 @@ title: Apache APISIX Ingress Controller Helm Chart # --> -# Apache APISIX Ingress Controller Helm Chart - ## Prerequisites - [Kubernetes 1.12+](https://kubernetes.io/docs/setup/) diff --git a/docs/en/latest/apisix.md b/docs/en/latest/apisix.md index 1ee9fda..68bf934 100644 --- a/docs/en/latest/apisix.md +++ b/docs/en/latest/apisix.md @@ -21,8 +21,6 @@ title: Apache APISIX Helm Chart # --> -# Apache APISIX Helm Chart - ## Dependencies Update the dependency chart
[apisix-dashboard] branch master updated (c68e2d2 -> b42904d)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from c68e2d2 feat: add limit-conn plugin form (#1728) add b42904d chore: use Enable instead of Create on the Plugin List (#1731) No new revisions were added by this update. Summary of changes: web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js | 4 ++-- web/cypress/integration/plugin/create-edit-delete-plugin.spec.js | 4 ++-- web/src/pages/Plugin/List.tsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
[apisix] branch master updated: ci: retry make deps (#4024)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 2e8f738 ci: retry make deps (#4024) 2e8f738 is described below commit 2e8f738ded52865b0e4dec5458d99b3323fffb21 Author: 罗泽轩 AuthorDate: Sun Apr 11 18:59:19 2021 +0800 ci: retry make deps (#4024) cool pr!! --- ci/common.sh | 8 +++- ci/linux_apisix_current_luarocks_runner.sh | 9 - utils/centos7-ci.sh| 8 +++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ci/common.sh b/ci/common.sh index 62760a6..11829fd 100644 --- a/ci/common.sh +++ b/ci/common.sh @@ -26,7 +26,13 @@ export_or_prefix() { create_lua_deps() { echo "Create lua deps cache" -make deps +for (( i = 0; i < 10; i++ )); do +if [[ "$i" -eq 10 ]]; then +echo "failed to make deps in time" +exit 1 +fi +make deps && break +done # maybe reopen this feature later # luarocks install luacov-coveralls --tree=deps --local > build.log 2>&1 || (cat build.log && exit 1) diff --git a/ci/linux_apisix_current_luarocks_runner.sh b/ci/linux_apisix_current_luarocks_runner.sh index e055c4c..5989c66 100755 --- a/ci/linux_apisix_current_luarocks_runner.sh +++ b/ci/linux_apisix_current_luarocks_runner.sh @@ -33,7 +33,14 @@ script() { sudo rm -rf /usr/local/apisix # install APISIX with local version -sudo luarocks install rockspec/apisix-master-0.rockspec --only-deps > build.log 2>&1 || (cat build.log && exit 1) +for (( i = 0; i < 10; i++ )); do +if [[ "$i" -eq 10 ]]; then +echo "failed to install in time" +cat build.log && exit 1 +exit 1 +fi +sudo luarocks install rockspec/apisix-master-0.rockspec --only-deps > build.log 2>&1 && break +done sudo luarocks make rockspec/apisix-master-0.rockspec > build.log 2>&1 || (cat build.log && exit 1) mkdir cli_tmp && cd cli_tmp diff --git a/utils/centos7-ci.sh b/utils/centos7-ci.sh index 32ec963..8a7fabc 100755 --- a/utils/centos7-ci.sh +++ b/utils/centos7-ci.sh @@ -56,7 +56,13 @@ install_dependencies() { # install dependencies git clone https://github.com/iresty/test-nginx.git test-nginx -make deps +for (( i = 0; i < 10; i++ )); do +if [[ "$i" -eq 10 ]]; then +echo "failed to make deps in time" +exit 1 +fi +make deps && break +done } run_case() {
[apisix] branch master updated: feat: support upstream mTLS (#4005)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new e295ebb feat: support upstream mTLS (#4005) e295ebb is described below commit e295ebb9e811e505f0c9f6b604dd6a7b25bb0a74 Author: 罗泽轩 AuthorDate: Sat Apr 10 18:55:20 2021 +0800 feat: support upstream mTLS (#4005) --- apisix/admin/routes.lua | 4 +- apisix/admin/services.lua | 4 +- apisix/admin/upstreams.lua| 77 + apisix/http/service.lua | 41 +-- apisix/router.lua | 40 +-- apisix/schema_def.lua | 28 +- apisix/ssl.lua| 50 +++- apisix/ssl/router/radixtree_sni.lua | 49 +-- apisix/upstream.lua | 202 ++--- docs/en/latest/admin-api.md | 6 + docs/zh/latest/admin-api.md | 6 + t/APISIX.pm | 10 + t/config-center-yaml/route-upstream.t | 54 t/node/upstream-mtls.t| 547 ++ 14 files changed, 867 insertions(+), 251 deletions(-) diff --git a/apisix/admin/routes.lua b/apisix/admin/routes.lua index 28d0272..cad66fc 100644 --- a/apisix/admin/routes.lua +++ b/apisix/admin/routes.lua @@ -16,8 +16,8 @@ -- local expr = require("resty.expr.v1") local core = require("apisix.core") +local apisix_upstream = require("apisix.upstream") local schema_plugin = require("apisix.admin.plugins").check_schema -local upstreams = require("apisix.admin.upstreams") local utils = require("apisix.admin.utils") local tostring = tostring local type = type @@ -68,7 +68,7 @@ local function check_conf(id, conf, need_id) local upstream_conf = conf.upstream if upstream_conf then -local ok, err = upstreams.check_upstream_conf(upstream_conf) +local ok, err = apisix_upstream.check_upstream_conf(upstream_conf) if not ok then return nil, {error_msg = err} end diff --git a/apisix/admin/services.lua b/apisix/admin/services.lua index 9ac26aa..4b6e98e 100644 --- a/apisix/admin/services.lua +++ b/apisix/admin/services.lua @@ -16,8 +16,8 @@ -- local core = require("apisix.core") local get_routes = require("apisix.router").http_routes +local apisix_upstream = require("apisix.upstream") local schema_plugin = require("apisix.admin.plugins").check_schema -local upstreams = require("apisix.admin.upstreams") local utils = require("apisix.admin.utils") local tostring = tostring local ipairs = ipairs @@ -63,7 +63,7 @@ local function check_conf(id, conf, need_id) local upstream_conf = conf.upstream if upstream_conf then -local ok, err = upstreams.check_upstream_conf(upstream_conf) +local ok, err = apisix_upstream.check_upstream_conf(upstream_conf) if not ok then return nil, {error_msg = err} end diff --git a/apisix/admin/upstreams.lua b/apisix/admin/upstreams.lua index 312bf77..d367ec3 100644 --- a/apisix/admin/upstreams.lua +++ b/apisix/admin/upstreams.lua @@ -17,6 +17,7 @@ local core = require("apisix.core") local get_routes = require("apisix.router").http_routes local get_services = require("apisix.http.service").services +local apisix_upstream = require("apisix.upstream") local utils = require("apisix.admin.utils") local tostring = tostring local ipairs = ipairs @@ -28,77 +29,6 @@ local _M = { } -local function get_chash_key_schema(hash_on) -if not hash_on then -return nil, "hash_on is nil" -end - -if hash_on == "vars" then -return core.schema.upstream_hash_vars_schema -end - -if hash_on == "header" or hash_on == "cookie" then -return core.schema.upstream_hash_header_schema -end - -if hash_on == "consumer" then -return nil, nil -end - -if hash_on == "vars_combinations" then -return core.schema.upstream_hash_vars_combinations_schema -end - -return nil, "invalid hash_on type " .. hash_on -end - - -local function check_upstream_conf(conf) -local ok, err = core.schema.check(core.schema.upstream, conf) -if not ok then -return false, "invalid configuration: " .. err -end - -if conf.pass_host == "node" and conf.nodes and -core.table.nkeys(conf.nodes) ~= 1 -then -return false, "only support single node for `node` mode currently" -end - -if conf.pass_host == "rewrite" and -(conf.upstream_host == nil or conf.upstream_host == "") -then -return false, "`upstream_host` can
[apisix] branch master updated: test: rewrite flaky consul_kv case (#3972)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new bb7d8a8 test: rewrite flaky consul_kv case (#3972) bb7d8a8 is described below commit bb7d8a8f53002984479572e34402e8f5055eb3e9 Author: 罗泽轩 AuthorDate: Sat Apr 10 18:53:41 2021 +0800 test: rewrite flaky consul_kv case (#3972) --- t/discovery/consul_kv.t | 20 1 file changed, 20 deletions(-) diff --git a/t/discovery/consul_kv.t b/t/discovery/consul_kv.t index b80a189..516b854 100644 --- a/t/discovery/consul_kv.t +++ b/t/discovery/consul_kv.t @@ -315,16 +315,6 @@ location /sleep { --- timeout: 6 --- request eval [ -"DELETE /v1/kv/upstreams/webpages/?recurse=true", -"PUT /v1/kv/upstreams/webpages/127.0.0.1:30511\n" . "{\"weight\": 1, \"max_fails\": 2, \"fail_timeout\": 1}", -"GET /sleep?sec=5", -"GET /hello", - -"PUT /v1/kv/upstreams/webpages/127.0.0.1:30512\n" . "{\"weight\": 1, \"max_fails\": 2, \"fail_timeout\": 1}", -"GET /sleep", -"GET /hello", -"GET /hello", - "DELETE /v1/kv/upstreams/webpages/127.0.0.1:30511", "DELETE /v1/kv/upstreams/webpages/127.0.0.1:30512", "PUT /v1/kv/upstreams/webpages/127.0.0.1:30513\n" . "{\"weight\": 1, \"max_fails\": 2, \"fail_timeout\": 1}", @@ -352,16 +342,6 @@ location /sleep { [ qr/true/, qr/true/, -qr/ok\n/, -qr/server 1\n/, - -qr/true/, -qr/ok\n/, -qr/server [1-2]\n/, -qr/server [1-2]\n/, - -qr/true/, -qr/true/, qr/true/, qr/true/, qr/ok\n/,
[apisix] branch master updated (86e168e -> 0c96ffd)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 86e168e test: enable master-worker mode by default (#3927) add 0c96ffd test: make consul_kv stable (#3924) No new revisions were added by this update. Summary of changes: t/discovery/consul_kv.t | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
[apisix] branch master updated: test: enable master-worker mode by default (#3927)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 86e168e test: enable master-worker mode by default (#3927) 86e168e is described below commit 86e168e711713531eeafdd0a75682b150e0d0109 Author: 罗泽轩 AuthorDate: Mon Mar 29 23:38:07 2021 +0800 test: enable master-worker mode by default (#3927) --- apisix/debug.lua | 2 +- apisix/plugins/skywalking.lua | 2 +- apisix/timers.lua | 2 +- t/APISIX.pm | 1 + t/admin/plugins-reload.t | 1 - t/config-center-yaml/plugin-configs.t | 1 - t/config-center-yaml/plugin.t | 2 ++ t/core/config_etcd.t | 1 + t/core/random.t | 1 - t/debug/debug-mode.t | 4 +--- t/discovery/dns/mix.t | 1 - t/discovery/dns/sanity.t | 1 - t/node/healthcheck-discovery.t| 1 - t/node/healthcheck-ipv6.t | 1 - t/node/healthcheck-multiple-worker.t | 1 - t/node/healthcheck-passive.t | 1 - t/node/healthcheck-stop-checker.t | 1 - t/node/healthcheck.t | 1 - t/node/healthcheck2.t | 1 - t/node/plugin-configs.t | 1 - t/node/route-delete.t | 5 + t/node/upstream-discovery.t | 1 - t/plugin/error-log-logger.t | 1 - t/plugin/fault-injection2.t | 1 - t/plugin/node-status.t| 1 - t/plugin/server-info.t| 1 - t/plugin/traffic-split2.t | 1 - t/stream-node/random.t| 1 - 28 files changed, 13 insertions(+), 26 deletions(-) diff --git a/apisix/debug.lua b/apisix/debug.lua index b0ab038..8cd0135 100644 --- a/apisix/debug.lua +++ b/apisix/debug.lua @@ -201,7 +201,7 @@ end function _M.init_worker() -if process.type() ~= "worker" and process.type() ~= "single" then +if process.type() ~= "worker" then return end diff --git a/apisix/plugins/skywalking.lua b/apisix/plugins/skywalking.lua index cd66035..c0f74f3 100644 --- a/apisix/plugins/skywalking.lua +++ b/apisix/plugins/skywalking.lua @@ -102,7 +102,7 @@ end function _M.init() -if process.type() ~= "worker" and process.type() ~= "single" then +if process.type() ~= "worker" then return end diff --git a/apisix/timers.lua b/apisix/timers.lua index a08f651..b30c269 100644 --- a/apisix/timers.lua +++ b/apisix/timers.lua @@ -53,7 +53,7 @@ end local function is_privileged() -return process.type() == "privileged agent" or process.type() == "single" +return process.type() == "privileged agent" end diff --git a/t/APISIX.pm b/t/APISIX.pm index 2c96712..2182430 100644 --- a/t/APISIX.pm +++ b/t/APISIX.pm @@ -26,6 +26,7 @@ no_long_string(); no_shuffle(); no_root_location(); # avoid generated duplicate 'location /' worker_connections(128); +master_on(); my $apisix_home = $ENV{APISIX_HOME} || cwd(); my $nginx_binary = $ENV{'TEST_NGINX_BINARY'} || 'nginx'; diff --git a/t/admin/plugins-reload.t b/t/admin/plugins-reload.t index d0dc15a..e46b25a 100644 --- a/t/admin/plugins-reload.t +++ b/t/admin/plugins-reload.t @@ -22,7 +22,6 @@ no_root_location(); no_shuffle(); log_level("info"); workers(2); -master_on(); add_block_preprocessor(sub { my ($block) = @_; diff --git a/t/config-center-yaml/plugin-configs.t b/t/config-center-yaml/plugin-configs.t index 309388d..e7a22b7 100644 --- a/t/config-center-yaml/plugin-configs.t +++ b/t/config-center-yaml/plugin-configs.t @@ -20,7 +20,6 @@ repeat_each(1); log_level('info'); no_root_location(); no_shuffle(); -master_on(); add_block_preprocessor(sub { my ($block) = @_; diff --git a/t/config-center-yaml/plugin.t b/t/config-center-yaml/plugin.t index bcd4575..1a5d95d 100644 --- a/t/config-center-yaml/plugin.t +++ b/t/config-center-yaml/plugin.t @@ -77,6 +77,8 @@ qr/load\(\): new plugins/ --- grep_error_log_out load(): new plugins load(): new plugins +load(): new plugins +load(): new plugins diff --git a/t/core/config_etcd.t b/t/core/config_etcd.t index ec03aff..fbffc9f 100644 --- a/t/core/config_etcd.t +++ b/t/core/config_etcd.t @@ -258,3 +258,4 @@ qr/etcd auth failed/ etcd auth failed etcd auth failed etcd auth failed +etcd auth failed diff --git a/t/core/random.t b/t/core/random.t index 8d7d403..afadec0 100644 --- a/t/core/random.t +++ b/t/core/random.t @@ -17,7 +17,6 @@ use t::APISIX 'no_plan'; -master_on(); workers(4); repeat_each(1); no_long_string(); diff --git a/t/debug/debug-mode.t b/t/debug/debug-mode.t index d6a729d..87f3e19 100644 --- a/t/debug/debug-mode.t +++ b/t/debug/debu
[apisix] branch master updated: ci: the last day of travis (#3926)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 664c760 ci: the last day of travis (#3926) 664c760 is described below commit 664c76016786c7070bee9e4bf2ffcd6916279444 Author: 罗泽轩 AuthorDate: Mon Mar 29 23:34:01 2021 +0800 ci: the last day of travis (#3926) --- .github/workflows/build.yml | 8 .gitignore | 3 +-- Makefile| 8 {.travis => ci}/ASF-Release.cfg | 2 +- {.travis => ci}/ASFLicenseHeaderMarkdown.txt| 0 {.travis => ci}/common.sh | 0 {.travis => ci}/linux_apisix_current_luarocks_runner.sh | 2 +- {.travis => ci}/linux_apisix_master_luarocks_runner.sh | 2 +- {.travis => ci}/linux_openresty_1_15_runner.sh | 2 +- {.travis => ci}/linux_openresty_1_17_runner.sh | 2 +- {.travis => ci}/linux_openresty_common_runner.sh| 6 +++--- {.travis => ci}/linux_openresty_mtls_runner.sh | 6 +++--- {.travis => ci}/linux_openresty_runner.sh | 2 +- {.travis => ci}/linux_tengine_runner.sh | 6 +++--- docs/en/latest/install-dependencies.md | 2 +- docs/zh/latest/install-dependencies.md | 2 +- t/node/healthcheck-ipv6.t | 10 +- t/node/remote-addr-ipv6.t | 10 +- t/node/upstream-ipv6.t | 10 +- utils/centos7-ci.sh | 2 +- 20 files changed, 30 insertions(+), 55 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce34539..9110be8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,14 +70,14 @@ jobs: - name: Remove source code if: ${{ startsWith(github.ref, 'refs/heads/release/') && !endsWith(matrix.os_name, 'luarocks') }} run: | - rm -rf $(ls -1 --ignore=*.tgz --ignore=.travis --ignore=t --ignore=utils --ignore=.github) + rm -rf $(ls -1 --ignore=*.tgz --ignore=ci --ignore=t --ignore=utils --ignore=.github) tar zxvf ${{ steps.branch_env.outputs.fullname }} - name: Linux Get dependencies run: sudo apt install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl - name: Linux Before install -run: sudo ./.travis/${{ matrix.os_name }}_runner.sh before_install +run: sudo ./ci/${{ matrix.os_name }}_runner.sh before_install - name: Start Dubbo Backend if: matrix.os_name == 'linux_openresty' @@ -140,10 +140,10 @@ jobs: - name: Linux Install run: | sudo --preserve-env=OPENRESTY_VERSION \ -./.travis/${{ matrix.os_name }}_runner.sh do_install +./ci/${{ matrix.os_name }}_runner.sh do_install - name: Linux Script -run: sudo ./.travis/${{ matrix.os_name }}_runner.sh script +run: sudo ./ci/${{ matrix.os_name }}_runner.sh script - name: Publish Artifact if: ${{ startsWith(github.ref, 'refs/heads/release/') && matrix.os_name == 'linux_openresty' }} diff --git a/.gitignore b/.gitignore index 691ed4e..98b0b7e 100644 --- a/.gitignore +++ b/.gitignore @@ -61,8 +61,7 @@ t/lib/dubbo-backend/dubbo-backend-provider/target/ *.iml \.* !.github/ -!.travis/ -.travis/openwhisk-utilities/ +ci/openwhisk-utilities/ !.gitmodules !.markdownlint.yml !.yamllint diff --git a/Makefile b/Makefile index 83fd0a7..f4d1e97 100644 --- a/Makefile +++ b/Makefile @@ -240,11 +240,11 @@ test: ### license-check:Check Lua source code for Apache License .PHONY: license-check license-check: -ifeq ("$(wildcard .travis/openwhisk-utilities/scancode/scanCode.py)", "") - git clone https://github.com/apache/openwhisk-utilities.git .travis/openwhisk-utilities - cp .travis/ASF* .travis/openwhisk-utilities/scancode/ +ifeq ("$(wildcard ci/openwhisk-utilities/scancode/scanCode.py)", "") + git clone https://github.com/apache/openwhisk-utilities.git ci/openwhisk-utilities + cp ci/ASF* ci/openwhisk-utilities/scancode/ endif - .travis/openwhisk-utilities/scancode/scanCode.py --config .travis/ASF-Release.cfg ./ + ci/openwhisk-utilities/scancode/scanCode.py --config ci/ASF-Release.cfg ./ release-src: compress-tar diff --git a/.travis/ASF-Release.cfg b/ci/ASF-Release.cfg similarity index 99% rename from .travis/ASF-Release.cfg rename to ci/ASF-Release.cfg index b4ba843..10de19f 100644 --- a/.travis/ASF-Release.cf
[apisix] branch master updated: fix: use the builtin server by default (#3907)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 83ab543 fix: use the builtin server by default (#3907) 83ab543 is described below commit 83ab5439a03ebff133a36045b8e9cc3003b8baf0 Author: 罗泽轩 AuthorDate: Thu Mar 25 23:49:38 2021 +0800 fix: use the builtin server by default (#3907) Fix #3906 --- apisix/cli/ngx_tpl.lua | 14 +++--- t/cli/test_main.sh | 69 --- t/cli/test_snippet.sh | 123 + 3 files changed, 131 insertions(+), 75 deletions(-) diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua index 2bfa582..00cda09 100644 --- a/apisix/cli/ngx_tpl.lua +++ b/apisix/cli/ngx_tpl.lua @@ -345,31 +345,33 @@ http { server { {% for _, item in ipairs(node_listen) do %} -listen {* item.port *} {% if enable_reuseport then %} reuseport {% end %} {% if item.enable_http2 then %} http2 {% end %}; +listen {* item.port *} default_server {% if enable_reuseport then %} reuseport {% end %} {% if item.enable_http2 then %} http2 {% end %}; {% end %} {% if ssl.enable then %} {% for _, port in ipairs(ssl.listen_port) do %} -listen {* port *} ssl {% if ssl.enable_http2 then %} http2 {% end %} {% if enable_reuseport then %} reuseport {% end %}; +listen {* port *} ssl default_server {% if ssl.enable_http2 then %} http2 {% end %} {% if enable_reuseport then %} reuseport {% end %}; {% end %} {% end %} {% if proxy_protocol and proxy_protocol.listen_http_port then %} -listen {* proxy_protocol.listen_http_port *} proxy_protocol; +listen {* proxy_protocol.listen_http_port *} default_server proxy_protocol; {% end %} {% if proxy_protocol and proxy_protocol.listen_https_port then %} -listen {* proxy_protocol.listen_https_port *} ssl {% if ssl.enable_http2 then %} http2 {% end %} proxy_protocol; +listen {* proxy_protocol.listen_https_port *} ssl default_server {% if ssl.enable_http2 then %} http2 {% end %} proxy_protocol; {% end %} {% if enable_ipv6 then %} {% for _, item in ipairs(node_listen) do %} -listen [::]:{* item.port *} {% if enable_reuseport then %} reuseport {% end %} {% if item.enable_http2 then %} http2 {% end %}; +listen [::]:{* item.port *} default_server {% if enable_reuseport then %} reuseport {% end %} {% if item.enable_http2 then %} http2 {% end %}; {% end %} {% if ssl.enable then %} {% for _, port in ipairs(ssl.listen_port) do %} -listen [::]:{* port *} ssl {% if ssl.enable_http2 then %} http2 {% end %} {% if enable_reuseport then %} reuseport {% end %}; +listen [::]:{* port *} ssl default_server {% if ssl.enable_http2 then %} http2 {% end %} {% if enable_reuseport then %} reuseport {% end %}; {% end %} {% end %} {% end %} {% -- if enable_ipv6 %} +server_name _; + {% if ssl.ssl_trusted_certificate ~= nil then %} lua_ssl_trusted_certificate {* ssl.ssl_trusted_certificate *}; {% end %} diff --git a/t/cli/test_main.sh b/t/cli/test_main.sh index ca287bb..e2dc488 100755 --- a/t/cli/test_main.sh +++ b/t/cli/test_main.sh @@ -481,75 +481,6 @@ fi echo "passed: found 'my_dict' in nginx.conf" -# allow injecting configuration snippets - -echo ' -apisix: -node_listen: 9080 -enable_admin: true -port_admin: 9180 -stream_proxy: -tcp: -- 9100 -nginx_config: -main_configuration_snippet: | -daemon on; -http_configuration_snippet: | -chunked_transfer_encoding on; -http_server_configuration_snippet: | -set $my "var"; -http_admin_configuration_snippet: | -log_format admin "$request_time $pipe"; -http_end_configuration_snippet: | -server_names_hash_bucket_size 128; -stream_configuration_snippet: | -tcp_nodelay off; -' > conf/config.yaml - -make init - -grep "daemon on;" -A 2 conf/nginx.conf | grep "configuration snippet ends" > /dev/null -if [ ! $? -eq 0 ]; then -echo "failed: can't inject main configuration" -exit 1 -fi - -grep "chunked_transfer_encoding on;" -A 2 conf/nginx.conf | grep "configuration snippet ends" > /dev/null -if [ ! $? -eq 0 ]; then -echo "failed: can't inject http configuration" -exit 1 -fi - -grep 'set $my "var";' -A 2 conf/nginx.conf | grep "configuration snippet ends" > /dev/null -if [ ! $? -eq 0 ]; then -echo "failed: can't inject http server configuration" -exit 1 -fi - -grep 'log_format a
[apisix] branch master updated: feat: support mTLS with etcd (#3905)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 92b3528 feat: support mTLS with etcd (#3905) 92b3528 is described below commit 92b352862a7770daa0b1ac50893c4c68d84af877 Author: 罗泽轩 AuthorDate: Thu Mar 25 23:40:40 2021 +0800 feat: support mTLS with etcd (#3905) --- apisix/core/config_etcd.lua | 11 +- apisix/core/etcd.lua | 13 +- apisix/patch.lua | 39 +- rockspec/apisix-master-0.rockspec | 2 +- t/APISIX.pm | 9 +- t/core/etcd-mtls.t| 273 ++ 6 files changed, 339 insertions(+), 8 deletions(-) diff --git a/apisix/core/config_etcd.lua b/apisix/core/config_etcd.lua index 10d54f3..a9888a3 100644 --- a/apisix/core/config_etcd.lua +++ b/apisix/core/config_etcd.lua @@ -506,8 +506,15 @@ do -- default to verify etcd cluster certificate etcd_conf.ssl_verify = true -if etcd_conf.tls and etcd_conf.tls.verify == false then -etcd_conf.ssl_verify = false +if etcd_conf.tls then +if etcd_conf.tls.verify == false then +etcd_conf.ssl_verify = false +end + +if etcd_conf.tls.cert then +etcd_conf.ssl_cert_path = etcd_conf.tls.cert +etcd_conf.ssl_key_path = etcd_conf.tls.key +end end local err diff --git a/apisix/core/etcd.lua b/apisix/core/etcd.lua index 6a30728..6ce2742 100644 --- a/apisix/core/etcd.lua +++ b/apisix/core/etcd.lua @@ -24,6 +24,7 @@ local tonumber = tonumber local _M = {} +-- this function create the etcd client instance used in the Admin API local function new() local local_conf, err = fetch_local_conf() if not local_conf then @@ -40,8 +41,16 @@ local function new() etcd_conf.ssl_verify = true -- default to verify etcd cluster certificate -if etcd_conf.tls and etcd_conf.tls.verify == false then -etcd_conf.ssl_verify = false +etcd_conf.ssl_verify = true +if etcd_conf.tls then +if etcd_conf.tls.verify == false then +etcd_conf.ssl_verify = false +end + +if etcd_conf.tls.cert then +etcd_conf.ssl_cert_path = etcd_conf.tls.cert +etcd_conf.ssl_key_path = etcd_conf.tls.key +end end local etcd_cli diff --git a/apisix/patch.lua b/apisix/patch.lua index e310bca..850c6b1 100644 --- a/apisix/patch.lua +++ b/apisix/patch.lua @@ -14,6 +14,7 @@ -- See the License for the specific language governing permissions and -- limitations under the License. -- +local require = require local socket = require("socket") local unix_socket = require("socket.unix") local ssl = require("ssl") @@ -30,9 +31,19 @@ local setmetatable = setmetatable local type = type +local config_local local _M = {} +local function get_local_conf() +if not config_local then +config_local = require("apisix.core.config_local") +end + +return config_local.local_conf() +end + + local function flatten(args) local buf = new_tab(#args, 0) for i, v in ipairs(args) do @@ -119,7 +130,12 @@ local luasocket_wrapper = { return self.sock:settimeout(time) end, -sslhandshake = function (self, reused_session, server_name, verify, send_status_req) +tlshandshake = function (self, options) +local reused_session = options.reused_session +local server_name = options.server_name +local verify = options.verify +local send_status_req = options.ocsp_status_req + if reused_session then log(WARN, "reused_session is not supported yet") end @@ -132,6 +148,8 @@ local luasocket_wrapper = { mode = "client", protocol = "any", verify = verify and "peer" or "none", +certificate = options.client_cert_path, +key = options.client_priv_key_path, options = { "all", "no_sslv2", @@ -140,6 +158,16 @@ local luasocket_wrapper = { } } +local local_conf, err = get_local_conf() +if not local_conf then +return nil, err +end + +local apisix_ssl = local_conf.apisix.ssl +if apisix_ssl and apisix_ssl.ssl_trusted_certificate then +params.cafile = apisix_ssl.ssl_trusted_certificate +end + local sec_sock, err = ssl.wrap(self.sock, params) if not sec_sock then return false, err @@ -157,6 +185,15 @@ local luasocket_wrapper = { self.sock = sec_sock return true +end, + +sslhandsh
[apisix] branch master updated: fix: corrent SRV record priority (#3896)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 654b1a9 fix: corrent SRV record priority (#3896) 654b1a9 is described below commit 654b1a91a72342a0184ada5158b0144944d72049 Author: 罗泽轩 AuthorDate: Wed Mar 24 09:59:03 2021 +0800 fix: corrent SRV record priority (#3896) Fix #3895 --- apisix/core/dns/client.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/apisix/core/dns/client.lua b/apisix/core/dns/client.lua index 2b28542..2e05374 100644 --- a/apisix/core/dns/client.lua +++ b/apisix/core/dns/client.lua @@ -73,6 +73,7 @@ local function resolve_srv(client, answers) local copy = table.deepcopy(res) copy.weight = weight / count copy.port = answer.port +copy.priority = answer.priority insert_tab(resolved_answers, copy) end end
[apisix] branch master updated: change(zipkin): rearrange the child span (#3877)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 116deb2 change(zipkin): rearrange the child span (#3877) 116deb2 is described below commit 116deb2f367f3ee68e3e237b9d334b916fd8287a Author: 罗泽轩 AuthorDate: Tue Mar 23 20:19:16 2021 +0800 change(zipkin): rearrange the child span (#3877) Fix #3827 --- apisix/plugins/zipkin.lua| 68 ++-- docs/en/latest/plugins/zipkin.md | 23 ++ docs/zh/latest/plugins/zipkin.md | 23 ++ t/lib/server.lua | 32 --- t/plugin/zipkin.t| 12 +++ t/plugin/zipkin2.t | 46 +++ 6 files changed, 169 insertions(+), 35 deletions(-) diff --git a/apisix/plugins/zipkin.lua b/apisix/plugins/zipkin.lua index 5872f34..2d74f33 100644 --- a/apisix/plugins/zipkin.lua +++ b/apisix/plugins/zipkin.lua @@ -25,6 +25,8 @@ local pairs = pairs local tonumber = tonumber local plugin_name = "zipkin" +local ZIPKIN_SPAN_VER_1 = 1 +local ZIPKIN_SPAN_VER_2 = 2 local lrucache = core.lrucache.new({ @@ -46,6 +48,10 @@ local schema = { description = "default is $server_addr, you can specify your external ip address", pattern = "^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" }, +span_version = { +enum = {ZIPKIN_SPAN_VER_1, ZIPKIN_SPAN_VER_2}, +default = ZIPKIN_SPAN_VER_2, +}, }, required = {"endpoint", "sample_ratio"} } @@ -182,17 +188,19 @@ function _M.rewrite(plugin_conf, ctx) tracer = tracer, wire_context = wire_context, request_span = request_span, -rewrite_span = nil, -access_span = nil, -proxy_span = nil, } local request_span = ctx.opentracing.request_span -ctx.opentracing.rewrite_span = request_span:start_child_span( -"apisix.rewrite", start_timestamp) +if conf.span_version == ZIPKIN_SPAN_VER_1 then +ctx.opentracing.rewrite_span = request_span:start_child_span("apisix.rewrite", + start_timestamp) -ctx.REWRITE_END_TIME = tracer:time() -ctx.opentracing.rewrite_span:finish(ctx.REWRITE_END_TIME) +ctx.REWRITE_END_TIME = tracer:time() +ctx.opentracing.rewrite_span:finish(ctx.REWRITE_END_TIME) +else +ctx.opentracing.proxy_span = request_span:start_child_span("apisix.proxy", + start_timestamp) +end end function _M.access(conf, ctx) @@ -201,17 +209,18 @@ function _M.access(conf, ctx) end local opentracing = ctx.opentracing +local tracer = opentracing.tracer -opentracing.access_span = opentracing.request_span:start_child_span( +if conf.span_version == ZIPKIN_SPAN_VER_1 then +opentracing.access_span = opentracing.request_span:start_child_span( "apisix.access", ctx.REWRITE_END_TIME) -local tracer = opentracing.tracer - -ctx.ACCESS_END_TIME = tracer:time() -opentracing.access_span:finish(ctx.ACCESS_END_TIME) +ctx.ACCESS_END_TIME = tracer:time() +opentracing.access_span:finish(ctx.ACCESS_END_TIME) -opentracing.proxy_span = opentracing.request_span:start_child_span( -"apisix.proxy", ctx.ACCESS_END_TIME) +opentracing.proxy_span = opentracing.request_span:start_child_span( +"apisix.proxy", ctx.ACCESS_END_TIME) +end -- send headers to upstream local outgoing_headers = {} @@ -228,11 +237,18 @@ function _M.header_filter(conf, ctx) end local opentracing = ctx.opentracing +local end_time = opentracing.tracer:time() -ctx.HEADER_FILTER_END_TIME = opentracing.tracer:time() -if opentracing.proxy_span then -opentracing.body_filter_span = opentracing.proxy_span:start_child_span( -"apisix.body_filter", ctx.HEADER_FILTER_END_TIME) +if conf.span_version == ZIPKIN_SPAN_VER_1 then +ctx.HEADER_FILTER_END_TIME = end_time +if opentracing.proxy_span then +opentracing.body_filter_span = opentracing.proxy_span:start_child_span( +"apisix.body_filter", ctx.HEADER_FILTER_END_TIME) +end +else +opentracing.proxy_span:finish(end_time) +opentracing.response_span = opentracing.request_span:start_child_span( +"apisix.response_span", ctx.HEADER_FILTER_END_TIME) end end @@ -245,15 +261,21 @@ function _M.log(conf, ctx) local opentracing = ctx.opentracing local
[apisix] branch master updated (9aa1833 -> 12f2223)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 9aa1833 ci: use build-apisix-openresty.sh instead (#3847) add 12f2223 feat: show how to specify --server when installing the dependency (#3884) No new revisions were added by this update. Summary of changes: Makefile | 9 +++-- docs/en/latest/FAQ.md | 7 +++ docs/zh/latest/FAQ.md | 8 +++- 3 files changed, 21 insertions(+), 3 deletions(-)
[apisix] branch master updated: ci: use build-apisix-openresty.sh instead (#3847)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 9aa1833 ci: use build-apisix-openresty.sh instead (#3847) 9aa1833 is described below commit 9aa18337229f2297f09d71a3ea86562ba4baa344 Author: 罗泽轩 AuthorDate: Tue Mar 23 20:07:48 2021 +0800 ci: use build-apisix-openresty.sh instead (#3847) --- t/config-center-yaml/ssl.t | 4 ++-- t/plugin/redirect.t | 4 ++-- t/router/multi-ssl-certs.t | 14 ++-- t/router/radixtree-sni.t | 42 ++-- t/router/radixtree-sni2.t| 14 ++-- utils/linux-install-openresty.sh | 46 +++- 6 files changed, 42 insertions(+), 82 deletions(-) diff --git a/t/config-center-yaml/ssl.t b/t/config-center-yaml/ssl.t index 673cdc0..961b625 100644 --- a/t/config-center-yaml/ssl.t +++ b/t/config-center-yaml/ssl.t @@ -175,7 +175,7 @@ end received: HTTP/1.1 200 OK close: 1 nil --- error_log -lua ssl server name: "test.com" +server name: "test.com" @@ -246,4 +246,4 @@ end received: HTTP/1.1 200 OK close: 1 nil --- error_log -lua ssl server name: "test.com" +server name: "test.com" diff --git a/t/plugin/redirect.t b/t/plugin/redirect.t index 377a046..768ddd3 100644 --- a/t/plugin/redirect.t +++ b/t/plugin/redirect.t @@ -635,7 +635,7 @@ location /t { return end -ngx.say("ssl handshake: ", type(sess)) +ngx.say("ssl handshake: ", sess ~= nil) local req = "GET /hello HTTP/1.0\r\nHost: test.com\r\nConnection: close\r\n\r\n" local bytes, err = sock:send(req) @@ -666,7 +666,7 @@ location /t { GET /t --- response_body eval qr{connected: 1 -ssl handshake: userdata +ssl handshake: true sent http request: 58 bytes. received: HTTP/1.1 200 OK received: Content-Type: text/plain diff --git a/t/router/multi-ssl-certs.t b/t/router/multi-ssl-certs.t index 02b2536..1c302f9 100644 --- a/t/router/multi-ssl-certs.t +++ b/t/router/multi-ssl-certs.t @@ -124,7 +124,7 @@ location /t { return end -ngx.say("ssl handshake: ", type(sess)) +ngx.say("ssl handshake: ", sess ~= nil) local req = "GET /hello HTTP/1.0\r\nHost: www.test.com\r\nConnection: close\r\n\r\n" local bytes, err = sock:send(req) @@ -155,7 +155,7 @@ location /t { GET /t --- response_body eval qr{connected: 1 -ssl handshake: userdata +ssl handshake: true sent http request: 62 bytes. received: HTTP/1.1 200 OK received: Content-Type: text/plain @@ -165,7 +165,7 @@ received: Server: APISIX/\d\.\d+(\.\d+)? received: \nreceived: hello world close: 1 nil} --- error_log -lua ssl server name: "www.test.com" +server name: "www.test.com" --- no_error_log [error] [alert] @@ -238,7 +238,7 @@ location /t { return end -ngx.say("ssl handshake: ", type(sess)) +ngx.say("ssl handshake: ", sess ~= nil) end -- do -- collectgarbage() } @@ -249,7 +249,7 @@ GET /t connected: 1 failed to do SSL handshake: 18: self signed certificate --- error_log -lua ssl server name: "www.test2.com" +server name: "www.test2.com" we have more than 1 ssl certs now --- no_error_log [error] @@ -323,7 +323,7 @@ location /t { return end -ngx.say("ssl handshake: ", type(sess)) +ngx.say("ssl handshake: ", sess ~= nil) end -- do -- collectgarbage() } @@ -334,7 +334,7 @@ GET /t connected: 1 failed to do SSL handshake: 18: self signed certificate --- error_log -lua ssl server name: "apisix.dev" +server name: "apisix.dev" we have more than 1 ssl certs now --- no_error_log [error] diff --git a/t/router/radixtree-sni.t b/t/router/radixtree-sni.t index 479e0a4..b8494d3 100644 --- a/t/router/radixtree-sni.t +++ b/t/router/radixtree-sni.t @@ -124,7 +124,7 @@ location /t { return end -ngx.say("ssl handshake: ", type(sess)) +ngx.say("ssl handshake: ", sess ~= nil) local req = "GET /hello HTTP/1.0\r\nHost: www.test.com\r\nConnection: close\r\n\r\n" local bytes, err = sock:send(req) @@ -155,7 +155,7 @@ location /t { GET /t --- response_body eval qr{connected: 1 -ssl handshake: userdata +ssl handshake: true sent http request: 62 bytes. received: HTTP/1.1 200 OK received: Content-Type: text/plain @@ -165,7 +165,7 @@ received: Server: APISIX/\d\.\d+(\.\d+)? received: \nreceived: hello world close: 1 nil} --- err
[apisix] branch master updated: feat: support priority in SRV record (#3845)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 216debe feat: support priority in SRV record (#3845) 216debe is described below commit 216debe22354af8f0bf8691d1bd8f15cd4af12c9 Author: 罗泽轩 AuthorDate: Tue Mar 23 20:05:23 2021 +0800 feat: support priority in SRV record (#3845) --- apisix/discovery/dns.lua| 4 docs/en/latest/discovery/dns.md | 15 --- t/coredns/db.test.local | 3 +++ t/discovery/dns/sanity.t| 19 +++ 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/apisix/discovery/dns.lua b/apisix/discovery/dns.lua index 64ffe1d..e599cf6 100644 --- a/apisix/discovery/dns.lua +++ b/apisix/discovery/dns.lua @@ -53,6 +53,10 @@ function _M.nodes(service_name) for i, r in ipairs(records) do if r.address then nodes[i] = {host = r.address, weight = r.weight or 1, port = r.port or port} +if r.priority then +-- for SRV record, nodes with lower priority are chosen first +nodes[i].priority = -r.priority +end end end diff --git a/docs/en/latest/discovery/dns.md b/docs/en/latest/discovery/dns.md index 0fd7977..4bb5461 100644 --- a/docs/en/latest/discovery/dns.md +++ b/docs/en/latest/discovery/dns.md @@ -92,8 +92,10 @@ Assumed you have the SRV record like this: A 300 IN A 1.1.1.1 B 300 IN A 1.1.1.2 B 300 IN A 1.1.1.3 -srv 86400 INSRV 10 60 1980 A -srv 86400 INSRV 10 20 1981 B + +; name TTL typepriorityweight port +srv 86400 INSRV 10 60 1980 A +srv 86400 INSRV 20 20 1981 B ``` Upstream configuration like: @@ -114,14 +116,15 @@ is the same as: "id": 1, "type": "roundrobin", "nodes": [ -{"host": "1.1.1.1", "port": 1980, "weight": 60}, -{"host": "1.1.1.2", "port": 1981, "weight": 10}, -{"host": "1.1.1.3", "port": 1981, "weight": 10} +{"host": "1.1.1.1", "port": 1980, "weight": 60, "priority": -10}, +{"host": "1.1.1.2", "port": 1981, "weight": 10, "priority": -20}, +{"host": "1.1.1.3", "port": 1981, "weight": 10, "priority": -20} ] } ``` Note that two records of domain B split the weight evenly. +For SRV record, nodes with lower priority are chosen first, so the final priority is negative. As for 0 weight SRV record, the [RFC 2782](https://www.ietf.org/rfc/rfc2782.txt) says: @@ -133,5 +136,3 @@ being selected. We treat weight 0 record has a weight of 1 so the node "have a very small chance of being selected", which is also the common way to treat this type of record. - -TODO: support priority. diff --git a/t/coredns/db.test.local b/t/coredns/db.test.local index e4bb2fa..27296bf 100644 --- a/t/coredns/db.test.local +++ b/t/coredns/db.test.local @@ -42,3 +42,6 @@ zero-weight.srv 86400 INSRV 10 0 1980 B split-weight.srv 86400 INSRV 10 100 1980 A split-weight.srv 86400 INSRV 10 0 1980 C + +priority.srv 86400 INSRV 10 60 1979 A +priority.srv 86400 INSRV 20 60 1980 B diff --git a/t/discovery/dns/sanity.t b/t/discovery/dns/sanity.t index 89b67a1..753b9bb 100644 --- a/t/discovery/dns/sanity.t +++ b/t/discovery/dns/sanity.t @@ -266,3 +266,22 @@ qr/upstream nodes: \{[^}]+\}/ qr/upstream nodes: \{(,?"127.0.0.(1:1980":200|3:1980":1|4:1980":1)){3}\}/ --- response_body hello world + + + +=== TEST 13: SRV (priority) +--- apisix_yaml +upstreams: +- service_name: "priority.srv.test.local" + discovery_type: dns + type: roundrobin + id: 1 +--- response_body +hello world +--- error_log +connect() failed +--- grep_error_log eval +qr/proxy request to \S+/ +--- grep_error_log_out +proxy request to 127.0.0.1:1979 +proxy request to 127.0.0.2:1980
[apisix] branch master updated: feat(cli): support etcd mTLS (#3836)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 1a09b0d feat(cli): support etcd mTLS (#3836) 1a09b0d is described below commit 1a09b0d7a0215de064f0f53f2c728ac60d98e366 Author: 罗泽轩 AuthorDate: Tue Mar 23 20:03:21 2021 +0800 feat(cli): support etcd mTLS (#3836) --- .github/workflows/build.yml | 16 + .travis/linux_apisix_current_luarocks_runner.sh | 2 + apisix/cli/etcd.lua | 16 - conf/config-default.yaml| 5 ++ t/cli/test_etcd_mtls.sh | 86 + utils/set-dns.sh| 3 + 6 files changed, 126 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46cfcd8..ce34539 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -121,6 +121,22 @@ jobs: -v ${{ github.workspace }}/t/certs:/certs \ bitnami/etcd:3.4.0 + - name: Running etcd server with mTLS +run: | +sudo docker run -d --rm --name etcd_mtls \ +-p 22379:22379 -p 22380:22380 \ +-e ALLOW_NONE_AUTHENTICATION=yes \ +-e ETCD_ADVERTISE_CLIENT_URLS=https://0.0.0.0:22379 \ +-e ETCD_LISTEN_CLIENT_URLS=https://0.0.0.0:22379 \ +-e ETCD_CERT_FILE=/certs/mtls_server.crt \ +-e ETCD_KEY_FILE=/certs/mtls_server.key \ +-e ETCD_CLIENT_CERT_AUTH=true \ +-e ETCD_TRUSTED_CA_FILE=/certs/mtls_ca.crt \ +-e GITHUB_ACTIONS=true \ +-e CI=true \ +-v ${{ github.workspace }}/t/certs:/certs \ +bitnami/etcd:3.4.0 + - name: Linux Install run: | sudo --preserve-env=OPENRESTY_VERSION \ diff --git a/.travis/linux_apisix_current_luarocks_runner.sh b/.travis/linux_apisix_current_luarocks_runner.sh index dc87896..7c660a8 100755 --- a/.travis/linux_apisix_current_luarocks_runner.sh +++ b/.travis/linux_apisix_current_luarocks_runner.sh @@ -56,6 +56,8 @@ script() { cd .. # apisix cli test +./utils/set-dns.sh + for f in ./t/cli/test_*.sh; do sudo PATH="$PATH" "$f" done diff --git a/apisix/cli/etcd.lua b/apisix/cli/etcd.lua index 621c001..2bea28f 100644 --- a/apisix/cli/etcd.lua +++ b/apisix/cli/etcd.lua @@ -110,8 +110,20 @@ local function request(url, yaml_conf) if str_sub(url.url, 1, 8) == "https://"; then local verify = "peer" -if yaml_conf.etcd.tls and yaml_conf.etcd.tls.verify == false then -verify = "none" +if yaml_conf.etcd.tls then +local cfg = yaml_conf.etcd.tls + +if cfg.verify == false then +verify = "none" +end + +url.certificate = cfg.cert +url.key = cfg.key + +local apisix_ssl = yaml_conf.apisix.ssl +if apisix_ssl and apisix_ssl.ssl_trusted_certificate then +url.cafile = apisix_ssl.ssl_trusted_certificate +end end url.verify = verify diff --git a/conf/config-default.yaml b/conf/config-default.yaml index 77dff0d..feda21e 100644 --- a/conf/config-default.yaml +++ b/conf/config-default.yaml @@ -202,6 +202,11 @@ etcd: # user: root# root username for etcd # password: 5tHkHhYkjr6cQY # root password for etcd tls: +# To enable etcd client certificate you need to build APISIX-Openresty, see +# http://apisix.apache.org/docs/apisix/how-to-build#6-build-openresty-for-apisix +# cert: /path/to/cert # path of certificate used by the etcd client +# key: /path/to/key # path of key used by the etcd client + verify: true # whether to verify the etcd endpoint certificate when setup a TLS connection to etcd, # the default value is true, e.g. the certificate will be verified strictly. diff --git a/t/cli/test_etcd_mtls.sh b/t/cli/test_etcd_mtls.sh new file mode 100755 index 000..9bf92a7 --- /dev/null +++ b/t/cli/test_etcd_mtls.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distri
[apisix] branch master updated: docs(dubbo): describe the returned data requirement (#3829)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new e836474 docs(dubbo): describe the returned data requirement (#3829) e836474 is described below commit e8364746cadbf1cc4bc3a577ed025f9a727ed3bf Author: 罗泽轩 AuthorDate: Tue Mar 23 20:00:34 2021 +0800 docs(dubbo): describe the returned data requirement (#3829) --- docs/en/latest/plugins/dubbo-proxy.md | 25 + 1 file changed, 25 insertions(+) diff --git a/docs/en/latest/plugins/dubbo-proxy.md b/docs/en/latest/plugins/dubbo-proxy.md index 59586b8..9b619d5 100644 --- a/docs/en/latest/plugins/dubbo-proxy.md +++ b/docs/en/latest/plugins/dubbo-proxy.md @@ -100,6 +100,31 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f1 You can follow the [Quick Start](https://github.com/alibaba/tengine/tree/master/modules/mod_dubbo#quick-start) example in Tengine and use the configuration above to test it. They should provide the same result. +The returned data from upstream dubbo service must be a `Map`. + +If the returned data is + +```json +{ +"status": "200", +"header1": "value1", +"header2": "valu2", +"body": "blahblah" +} +``` + +the converted HTTP response will be + +``` +HTTP/1.1 200 OK # "status" will be the status code +... +header1: value1 +header2: value2 +... + +blahblah # "body" will be the body +``` + ## Disable Plugin When you want to disable the dubbo-proxy plugin on a route/service, it is very simple,
[apisix-dashboard] branch master updated: test: add the create and delete plugin in drawer (#1597)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git The following commit(s) were added to refs/heads/master by this push: new 85efb37 test: add the create and delete plugin in drawer (#1597) 85efb37 is described below commit 85efb37b0c5fe76c94a85f9fc0dc13312083181d Author: Cliff Su AuthorDate: Mon Mar 22 20:45:40 2021 +0800 test: add the create and delete plugin in drawer (#1597) Fix #1411 --- web/cypress/fixtures/data.json | 1 + web/cypress/fixtures/selector.json | 3 ++ .../plugin/create-delete-in-drawer-plugin.spec.js | 55 ++ .../route/create-edit-delete-route.spec.js | 33 ++--- .../service/create-edit-delete-service.spec.js | 29 5 files changed, 115 insertions(+), 6 deletions(-) diff --git a/web/cypress/fixtures/data.json b/web/cypress/fixtures/data.json index 94be061..7f7b0fb 100644 --- a/web/cypress/fixtures/data.json +++ b/web/cypress/fixtures/data.json @@ -14,6 +14,7 @@ "serviceName2": "test_service2", "routeName": "test_route", "consumerName": "test_consumer", + "basicAuthPlugin": "basic-auth", "ip1": "127.0.0.1", "ip2": "127.0.0.2", "host1": "11.11.11.11", diff --git a/web/cypress/fixtures/selector.json b/web/cypress/fixtures/selector.json index 0e1c8d3..71d4b58 100644 --- a/web/cypress/fixtures/selector.json +++ b/web/cypress/fixtures/selector.json @@ -11,6 +11,7 @@ "errorNotification:": ".ant-notification-notice-error", "pluginCard": ".ant-card", + "pluginCardBordered": ".ant-card-bordered", "pageContent": ".ant-pro-page-container", "tableBody":".ant-table-tbody", @@ -19,6 +20,7 @@ "refresh": ".anticon-reload", "codemirror": ".CodeMirror", "disabledSwitcher": "#disable", + "checkedSwitcher": ".ant-switch-checked", "deleteButton": ".ant-btn-dangerous", "name": "#name", @@ -66,6 +68,7 @@ "usernameInput": "#control-ref_username", "passwordInput": "#control-ref_password", "drawer": ".ant-drawer-content", + "drawerFooter": ".ant-drawer-footer", "codemirrorScroll": ".CodeMirror-scroll", "drawerClose": ".ant-drawer-close", "descriptionSelector": "[title=Description]", diff --git a/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js new file mode 100644 index 000..dfc70ef --- /dev/null +++ b/web/cypress/integration/plugin/create-delete-in-drawer-plugin.spec.js @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* eslint-disable no-undef */ + +context('Delete Plugin List with the Drawer', () => { + const timeout = 5000; + + beforeEach(() => { +cy.login(); + +cy.fixture('selector.json').as('domSelector'); +cy.fixture('data.json').as('data'); + }); + + it('should visit plugin market and create plugin', function () { +cy.visit('/'); +cy.contains('Plugin').click(); +cy.contains('Create').click(); + + cy.contains(this.data.basicAuthPlugin).parents(this.domSelector.pluginCardBordered).within(() => { + cy.get('button').click({ force: true }); +}); + +cy.get(this.domSelector.drawer).should('be.visible').within(() => { + cy.get(this.domSelector.disabledSwitcher).click(); + cy.get(this.domSelector.checkedSwitcher).should('exist'); +}); + +cy.contains('button', 'Submit').click(); +cy.get(this.domSele
[apisix-dashboard] branch master updated (f4f27d1 -> 1ba32d9)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from f4f27d1 feat: check if the service is used by route when deleting (#1598) add 1ba32d9 feat: remove unnecessary cookie session (#1617) No new revisions were added by this update. Summary of changes: api/internal/route.go | 4 1 file changed, 4 deletions(-)
[apisix-ingress-controller] branch master updated: docs: fix website broken links (#299)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git The following commit(s) were added to refs/heads/master by this push: new 8d539a0 docs: fix website broken links (#299) 8d539a0 is described below commit 8d539a096036a93c34dffbc352242a872f5d4c6e Author: Cliff Su AuthorDate: Sun Mar 14 23:18:21 2021 +0800 docs: fix website broken links (#299) --- docs/en/latest/getting-started.md | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/en/latest/getting-started.md b/docs/en/latest/getting-started.md index 7ec9960..1db11dc 100644 --- a/docs/en/latest/getting-started.md +++ b/docs/en/latest/getting-started.md @@ -52,13 +52,13 @@ See [Design](./design.md) for more details. apisix-ingress-controller supports to be installed on some clouds such as AWS, GCP. -* [Install Ingress APISIX on Azure AKS](./docs/en/latest/deployments/azure.md) -* [Install Ingress APISIX on AWS EKS](./docs/en/latest/deployments/aws.md) -* [Install Ingress APISIX on ACK](./docs/en/latest/deployments/ack.md) -* [Install Ingress APISIX on Google Cloud GKE](./docs/en/latest/deployments/gke.md) -* [Install Ingress APISIX on Minikube](./docs/en/latest/deployments/minikube.md) -* [Install Ingress APISIX on KubeSphere](./docs/en/latest/deployments/kubesphere.md) -* [Install Ingress APISIX on K3S and RKE](./docs/en/latest/deployments/k3s-rke.md) +* [Install Ingress APISIX on Azure AKS](https://apisix.apache.org/docs/ingress-controller/deployments/azure) +* [Install Ingress APISIX on AWS EKS](https://apisix.apache.org/docs/ingress-controller/deployments/aws) +* [Install Ingress APISIX on ACK](https://apisix.apache.org/docs/ingress-controller/deployments/ack) +* [Install Ingress APISIX on Google Cloud GKE](https://apisix.apache.org/docs/ingress-controller/deployments/gke) +* [Install Ingress APISIX on Minikube](https://apisix.apache.org/docs/ingress-controller/deployments/minikube) +* [Install Ingress APISIX on KubeSphere](https://apisix.apache.org/docs/ingress-controller/deployments/kubesphere) +* [Install Ingress APISIX on K3S and RKE](https://apisix.apache.org/docs/ingress-controller/deployments/k3s-rke) ## Installation on Prem
[apisix] branch master updated: chore: fix spelling (#3253)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 4ebccaf chore: fix spelling (#3253) 4ebccaf is described below commit 4ebccafbdc7535242c675466337aa7dc942613cc Author: John Bampton AuthorDate: Mon Mar 15 00:53:34 2021 +1000 chore: fix spelling (#3253) --- .travis/linux_openresty_common_runner.sh | 2 +- apisix/core/config_util.lua | 2 +- apisix/plugins/api-breaker.lua | 2 +- apisix/plugins/http-logger.lua | 6 +++--- docs/en/latest/control-api.md| 2 +- docs/en/latest/plugins/api-breaker.md| 2 +- docs/en/latest/plugins/limit-count.md| 2 +- docs/en/latest/plugins/request-validation.md | 2 +- docs/en/latest/plugins/sls-logger.md | 2 +- rockspec/apisix-master-0.rockspec| 2 +- t/admin/routes.t | 2 +- t/admin/upstream2.t | 2 +- t/config-center-yaml/consumer.t | 2 +- t/control/schema.t | 2 +- t/core/config.t | 2 +- t/node/chash-hashon.t| 2 +- t/node/grpc-proxy.t | 2 +- t/node/healthcheck-ipv6.t| 2 +- t/plugin/batch-requests.t| 12 ++-- t/plugin/cors.t | 2 +- t/plugin/echo.t | 4 ++-- t/plugin/fault-injection.t | 2 +- t/plugin/limit-conn.t| 8 t/plugin/limit-count.t | 12 ++-- t/plugin/limit-req.t | 4 ++-- t/plugin/log-rotate.t| 2 +- t/plugin/prometheus2.t | 2 +- t/router/graphql.t | 2 +- 28 files changed, 45 insertions(+), 45 deletions(-) diff --git a/.travis/linux_openresty_common_runner.sh b/.travis/linux_openresty_common_runner.sh index bb2b254..d6ed7b6 100755 --- a/.travis/linux_openresty_common_runner.sh +++ b/.travis/linux_openresty_common_runner.sh @@ -124,7 +124,7 @@ apisix: ./bin/apisix init_etcd ./bin/apisix start -#start again --> fial +#start again --> fail res=`./bin/apisix start` if ! echo "$res" | grep "APISIX is running"; then echo "failed: APISIX runs repeatedly" diff --git a/apisix/core/config_util.lua b/apisix/core/config_util.lua index cc29ea4..b02d464 100644 --- a/apisix/core/config_util.lua +++ b/apisix/core/config_util.lua @@ -46,7 +46,7 @@ end -- Add a clean handler to a runtime configuration item. -- The clean handler will be called when the item is deleted from configuration -- or cancelled. Note that Nginx worker exit doesn't trigger the clean handler. --- Retuen an index so that we can cancel it later. +-- Return an index so that we can cancel it later. function _M.add_clean_handler(item, func) local idx = #item.clean_handlers + 1 item.clean_handlers[idx] = func diff --git a/apisix/plugins/api-breaker.lua b/apisix/plugins/api-breaker.lua index ec2f567..af3856b 100644 --- a/apisix/plugins/api-breaker.lua +++ b/apisix/plugins/api-breaker.lua @@ -100,7 +100,7 @@ end local function gen_lasttime_key(ctx) -return "unhealthy-lastime" .. core.request.get_host(ctx) .. ctx.var.uri +return "unhealthy-lasttime" .. core.request.get_host(ctx) .. ctx.var.uri end diff --git a/apisix/plugins/http-logger.lua b/apisix/plugins/http-logger.lua index 90d3a69..3437046 100644 --- a/apisix/plugins/http-logger.lua +++ b/apisix/plugins/http-logger.lua @@ -249,10 +249,10 @@ function _M.log(conf, ctx) data, err = core.json.encode(entries[1]) -- encode as single {} else local t = core.table.new(#entries, 0) -for i, entrie in ipairs(entries) do -t[i], err = core.json.encode(entrie) +for i, entry in ipairs(entries) do +t[i], err = core.json.encode(entry) if err then -core.log.warn("failed to encode http log: ", err, ", log data: ", entrie) +core.log.warn("failed to encode http log: ", err, ", log data: ", entry) break end end diff --git a/docs/en/latest/control-api.md b/docs/en/latest/control-api.md index 4efd872..d346163 100644 --- a/docs/en/latest/control-api.md +++ b/docs/en/latest/control-api.md @@ -81,7 +81,7 @@ Return the jsonschema used by this APISIX instance in the format below: ``` For `plugins` part, only enabled plugins will be returned. Some plugins may lack -of fields lik
[apisix-ingress-controller] branch master updated (8221ce6 -> 4901e3d)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git. from 8221ce6 chore: release 0.4.0 (#297) add 4901e3d docs: replace the architecture diagram (#301) No new revisions were added by this update. Summary of changes: README.md | 2 +- docs/assets/images/module-0.png | Bin 377084 -> 131265 bytes docs/assets/images/{module-0.png => module-2.png} | Bin 3 files changed, 1 insertion(+), 1 deletion(-) copy docs/assets/images/{module-0.png => module-2.png} (100%)
[apisix] branch master updated: fix: correct the luasocket patch (#3819)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new e957bc3 fix: correct the luasocket patch (#3819) e957bc3 is described below commit e957bc3daae73696051dd24ef4ef8e5eb9583e6f Author: 罗泽轩 AuthorDate: Sun Mar 14 18:06:04 2021 +0800 fix: correct the luasocket patch (#3819) --- apisix/patch.lua | 48 ++--- t/APISIX.pm | 3 +++ t/misc/patch.t | 73 +++- 3 files changed, 114 insertions(+), 10 deletions(-) diff --git a/apisix/patch.lua b/apisix/patch.lua index 124e8bd..e310bca 100644 --- a/apisix/patch.lua +++ b/apisix/patch.lua @@ -15,12 +15,15 @@ -- limitations under the License. -- local socket = require("socket") +local unix_socket = require("socket.unix") local ssl = require("ssl") local get_phase = ngx.get_phase local ngx_socket = ngx.socket local original_tcp = ngx.socket.tcp local concat_tab = table.concat local new_tab = require("table.new") +local log = ngx.log +local WARN = ngx.WARN local ipairs = ipairs local select = select local setmetatable = setmetatable @@ -49,6 +52,21 @@ end local luasocket_wrapper = { +connect = function (self, host, port) +if not port then +-- unix socket +self.sock = unix_socket() +if self.timeout then +self.sock:settimeout(self.timeout) +end + +local path = host:sub(#("unix:") + 1) +return self.sock:connect(path) +end + +return self.sock:connect(host, port) +end, + send = function(self, ...) if select('#', ...) == 1 and type(select(1, ...)) == "string" then -- fast path @@ -62,14 +80,18 @@ local luasocket_wrapper = { getreusedtimes = function () return 0 end, -setkeepalive = function () -return true +setkeepalive = function (self) +self.sock:close() +return 1 end, settimeout = function (self, time) if time then time = time / 1000 end + +self.timeout = time + return self.sock:settimeout(time) end, settimeouts = function (self, connect_time, read_time, write_time) @@ -91,20 +113,24 @@ local luasocket_wrapper = { else time = nil end + +self.timeout = time + return self.sock:settimeout(time) end, -sslhandshake = function (self, verify, opts) -if opts == nil then -opts = {} +sslhandshake = function (self, reused_session, server_name, verify, send_status_req) +if reused_session then +log(WARN, "reused_session is not supported yet") +end + +if send_status_req then +log(WARN, "send_status_req is not supported yet") end local params = { mode = "client", -protocol = opts.ssl_version or "any", -key = opts.key, -certificate = opts.cert, -cafile = opts.cafile, +protocol = "any", verify = verify and "peer" or "none", options = { "all", @@ -119,6 +145,10 @@ local luasocket_wrapper = { return false, err end +if server_name then +sec_sock:sni(server_name) +end + local success success, err = sec_sock:dohandshake() if not success then diff --git a/t/APISIX.pm b/t/APISIX.pm index 5d8ff8e..9898f01 100644 --- a/t/APISIX.pm +++ b/t/APISIX.pm @@ -367,6 +367,8 @@ _EOC_ $extra_init_by_lua _EOC_ +my $extra_init_worker_by_lua = $block->extra_init_worker_by_lua // ""; + my $http_config = $block->http_config // ''; $http_config .= <<_EOC_; $lua_deps_path @@ -417,6 +419,7 @@ _EOC_ init_worker_by_lua_block { require("apisix").http_init_worker() +$extra_init_worker_by_lua } log_format main escape=default '\$remote_addr - \$remote_user [\$time_local] \$http_host "\$request" \$status \$body_bytes_sent \$request_time "\$http_referer" "\$http_user_agent" \$upstream_addr \$upstream_status \$upstream_response_time "\$upstream_scheme://\$upstream_host\$upstream_uri"'; diff --git a/t/misc/patch.t b/t/misc/patch.t index edce04e..b94d5f5 100644 --- a/t/misc/patch.t +++ b/t/misc/patch.t @@ -21,6 +21,8 @@ no_long_string(); no_root_location(); log_level("info"); +$ENV{TEST_NGINX_HTML_DIR} ||= html_dir(); + add_block_preprocessor(sub { my ($block) = @_; @@ -28,7 +30,7 @@
[apisix] branch master updated (00baca2 -> 20ee3c1)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 00baca2 docs: added generated contributor over time service provider (#3813) add 20ee3c1 feat: add a safe exit to disable sync conf during start (#3812) No new revisions were added by this update. Summary of changes: apisix/core/config_etcd.lua | 14 +- conf/config-default.yaml| 1 + t/core/etcd-sync.t | 19 ++- 3 files changed, 28 insertions(+), 6 deletions(-)
[apisix-website] branch master updated: docs: added event about releasing APISIX 2.4 (#248)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-website.git The following commit(s) were added to refs/heads/master by this push: new b5d900b docs: added event about releasing APISIX 2.4 (#248) b5d900b is described below commit b5d900b48b85e04cf8c71019546a8d912a7a769c Author: Shivam Singh <57267960+1502shivam-si...@users.noreply.github.com> AuthorDate: Mon Mar 8 09:42:19 2021 +0530 docs: added event about releasing APISIX 2.4 (#248) --- .../events/2021-03-05-release-apache-apisix-2.4.md | 33 ++ website/static/data/events.json| 4 +++ 2 files changed, 37 insertions(+) diff --git a/website/events/2021-03-05-release-apache-apisix-2.4.md b/website/events/2021-03-05-release-apache-apisix-2.4.md new file mode 100644 index 000..6629056 --- /dev/null +++ b/website/events/2021-03-05-release-apache-apisix-2.4.md @@ -0,0 +1,33 @@ +--- +title: Release Apache APISIX 2.4 +--- + + + +### Change + +- change: global rules should not be executed on the internal api by default [#3396](https://github.com/apache/apisix/pull/3396) +- change: default to cache DNS record according to the TTL [#3530](https://github.com/apache/apisix/pull/3530) + +### Core + +- :sunrise: feat: support SRV record [#3686](https://github.com/apache/apisix/pull/3686) +- :sunrise: feat: add dns discovery [#3629](https://github.com/apache/apisix/pull/3629) +- :sunrise: feat: add consul kv discovery module [#3615](https://github.com/apache/apisix/pull/3615) +- :sunrise: feat: support to bind plugin config by `plugin_config_id` [#3567](https://github.com/apache/apisix/pull/3567) +- :sunrise: feat: support listen http2 with plaintext [#3547](https://github.com/apache/apisix/pull/3547) +- :sunrise: feat: support DNS record [#3484](https://github.com/apache/apisix/pull/3484) + +### Plugin + +- :sunrise: feat: the traffic-split plugin supports `upstream_id` [#3512](https://github.com/apache/apisix/pull/3512) +- :sunrise: feat(zipkin): support b3 req header [#3551](https://github.com/apache/apisix/pull/3551) + +### Bugfix + +- fix(chash): ensure retry can try every node [#3651](https://github.com/apache/apisix/pull/3651) +- fix: script does not work when the route is bound to a service [#3678](https://github.com/apache/apisix/pull/3678) +- fix: use openssl111 in openresty dir in precedence [#3603](https://github.com/apache/apisix/pull/3603) +- fix(zipkin): don't cache the per-req sample ratio [#3522](https://github.com/apache/apisix/pull/3522) + +For more changes, please refer to [Milestone](https://github.com/apache/apisix/milestone/13) diff --git a/website/static/data/events.json b/website/static/data/events.json index 4b46066..ef979d9 100644 --- a/website/static/data/events.json +++ b/website/static/data/events.json @@ -1,5 +1,9 @@ [ { +"title": "Release Apache APISIX 2.4", +"fileName": "2021-03-05-release-apache-apisix-2.4" + }, + { "title": "Release Apache APISIX Dashboard 2.4", "fileName": "2021-02-12-release-apache-apisix-dashboard-2.4" },
[apisix-dashboard] branch master updated: ci: add ci check for gofmt (#1498)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git The following commit(s) were added to refs/heads/master by this push: new 63254ac ci: add ci check for gofmt (#1498) 63254ac is described below commit 63254ac3be784f65ff2712d368b970125af6addf Author: nic-chen <33000667+nic-c...@users.noreply.github.com> AuthorDate: Tue Mar 2 01:04:36 2021 +0800 ci: add ci check for gofmt (#1498) --- .github/workflows/go-lint.yml | 19 ++- api/internal/handler/data_loader/route_import.go | 2 -- api/internal/handler/service/service.go | 1 - api/test/e2e/service_test.go | 1 - .../route_online_debug_suite_test.go | 1 - 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go-lint.yml b/.github/workflows/go-lint.yml index c579dd2..74d775e 100644 --- a/.github/workflows/go-lint.yml +++ b/.github/workflows/go-lint.yml @@ -10,9 +10,26 @@ on: jobs: golangci: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - name: run lint run: make go-lint + + gofmt: +runs-on: ubuntu-latest +steps: + - uses: actions/checkout@v2 + - name: setup go +uses: actions/setup-go@v1 +with: + go-version: '1.13' + - name: check gofmt +working-directory: ./api +run: | + diffs=`gofmt -l .` + if [[ -n $diffs ]]; then + echo "Files are not formatted by gofmt:" + echo $diffs + exit 1 + fi diff --git a/api/internal/handler/data_loader/route_import.go b/api/internal/handler/data_loader/route_import.go index d1ed425..b070d96 100644 --- a/api/internal/handler/data_loader/route_import.go +++ b/api/internal/handler/data_loader/route_import.go @@ -58,11 +58,9 @@ func NewImportHandler() (handler.RouteRegister, error) { }, nil } - var regPathVar = regexp.MustCompile(`{[\w.]*}`) var regPathRepeat = regexp.MustCompile(`-APISIX-REPEAT-URI-[\d]*`) - func (h *ImportHandler) ApplyRoute(r *gin.Engine) { r.POST("/apisix/admin/import/routes", wgin.Wraps(h.Import, wrapper.InputType(reflect.TypeOf(ImportInput{} diff --git a/api/internal/handler/service/service.go b/api/internal/handler/service/service.go index 15c4a76..174e9ba 100644 --- a/api/internal/handler/service/service.go +++ b/api/internal/handler/service/service.go @@ -261,4 +261,3 @@ func (h *Handler) Patch(c droplet.Context) (interface{}, error) { return ret, nil } - diff --git a/api/test/e2e/service_test.go b/api/test/e2e/service_test.go index 36885ab..9e03fca 100644 --- a/api/test/e2e/service_test.go +++ b/api/test/e2e/service_test.go @@ -355,4 +355,3 @@ func TestService_Update_Use_Patch_Method(t *testing.T) { testCaseCheck(tc, t) } } - diff --git a/api/test/e2enew/route_online_debug/route_online_debug_suite_test.go b/api/test/e2enew/route_online_debug/route_online_debug_suite_test.go index d92a29e..e040c5b 100644 --- a/api/test/e2enew/route_online_debug/route_online_debug_suite_test.go +++ b/api/test/e2enew/route_online_debug/route_online_debug_suite_test.go @@ -34,4 +34,3 @@ var _ = ginkgo.AfterSuite(func() { base.CleanResource("consumers") time.Sleep(base.SleepTime) }) -
[apisix] branch master updated: fix(chash): ensure retry can try every node (#3651)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new e58a55f fix(chash): ensure retry can try every node (#3651) e58a55f is described below commit e58a55fbc6e5ad2007ff206ac44096945c869390 Author: 罗泽轩 AuthorDate: Sat Feb 27 22:17:22 2021 +0800 fix(chash): ensure retry can try every node (#3651) Previously the default number of retry is equal to the number of node, but the same node will be tried again according to its weight. Also ensure the same picker will be used in the whole request, especially during the retry. --- apisix/balancer.lua | 8 +-- apisix/balancer/chash.lua | 39 -- t/admin/balancer.t| 2 ++ t/node/chash-balance.t| 60 +++ t/node/healthcheck.t | 2 +- 5 files changed, 106 insertions(+), 5 deletions(-) diff --git a/apisix/balancer.lua b/apisix/balancer.lua index 2540f2f..4be56fc 100644 --- a/apisix/balancer.lua +++ b/apisix/balancer.lua @@ -161,8 +161,12 @@ local function pick_server(route, ctx) version = version .. "#" .. checker.status_ver end -local server_picker = lrucache_server_picker(key, version, -create_server_picker, up_conf, checker) +-- the same picker will be used in the whole request, especially during the retry +local server_picker = ctx.server_picker +if not server_picker then +server_picker = lrucache_server_picker(key, version, + create_server_picker, up_conf, checker) +end if not server_picker then return nil, "failed to fetch server picker" end diff --git a/apisix/balancer/chash.lua b/apisix/balancer/chash.lua index df1568a..f9dbdbb 100644 --- a/apisix/balancer/chash.lua +++ b/apisix/balancer/chash.lua @@ -22,6 +22,9 @@ local str_gsub= string.gsub local pairs = pairs +local CONSISTENT_POINTS = 160 -- points per server, taken from `resty.chash` + + local _M = {} @@ -62,27 +65,59 @@ end function _M.new(up_nodes, upstream) local str_null = str_char(0) +local nodes_count = 0 +local safe_limit = 0 local servers, nodes = {}, {} for serv, weight in pairs(up_nodes) do local id = str_gsub(serv, ":", str_null) +nodes_count = nodes_count + 1 +safe_limit = safe_limit + weight servers[id] = serv nodes[id] = weight end +safe_limit = safe_limit * CONSISTENT_POINTS local picker = resty_chash:new(nodes) return { upstream = upstream, get = function (ctx) local id -if ctx.balancer_try_count > 1 and ctx.chash_last_server_index then -id, ctx.chash_last_server_index = picker:next(ctx.chash_last_server_index) +if ctx.balancer_tried_servers then +if ctx.balancer_tried_servers_count == nodes_count then +return nil, "all upstream servers tried" +end + +-- the 'safe_limit' is a best effort limit to prevent infinite loop caused by bug +for i = 1, safe_limit do +id, ctx.chash_last_server_index = picker:next(ctx.chash_last_server_index) +if not ctx.balancer_tried_servers[servers[id]] then +break +end +end else local chash_key = fetch_chash_hash_key(ctx, upstream) id, ctx.chash_last_server_index = picker:find(chash_key) end -- core.log.warn("chash id: ", id, " val: ", servers[id]) return servers[id] +end, +after_balance = function (ctx, before_retry) +if not before_retry then +if ctx.balancer_tried_servers then +core.tablepool.release("balancer_tried_servers", ctx.balancer_tried_servers) +ctx.balancer_tried_servers = nil +end + +return nil +end + +if not ctx.balancer_tried_servers then +ctx.balancer_tried_servers = core.tablepool.fetch("balancer_tried_servers", 0, 2) +end + +ctx.balancer_tried_servers[ctx.balancer_server] = true +ctx.balancer_tried_servers_count = (ctx.balancer_tried_servers_count or 0) + 1 end } end diff --git a/t/admin/balancer.t b/t/admin/balancer.t index b9a76c5..d1b9027 100644 --- a/t/admin/balancer.t +++ b/t/admin/balancer.t @@ -52,6 +52,8 @@ add_block_preprocessor(sub { for _, key in ipairs(keys) do ngx.say("host: ", key, "
[apisix] branch master updated: chore: capitalize the constant (#3672)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new e2f1fc6 chore: capitalize the constant (#3672) e2f1fc6 is described below commit e2f1fc6a7b7da070cfd253c8854358473193237c Author: 罗泽轩 AuthorDate: Sat Feb 27 20:33:30 2021 +0800 chore: capitalize the constant (#3672) See https://github.com/apache/apisix/pull/3629#discussion_r582423351 --- apisix/upstream.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apisix/upstream.lua b/apisix/upstream.lua index 7a363be..6ae81c0 100644 --- a/apisix/upstream.lua +++ b/apisix/upstream.lua @@ -26,8 +26,8 @@ local is_http = ngx.config.subsystem == "http" local upstreams local healthcheck -local http_code_upstream_unavailable = ngx.HTTP_SERVICE_UNAVAILABLE +local HTTP_CODE_UPSTREAM_UNAVAILABLE = 503 local _M = {} @@ -216,7 +216,7 @@ function _M.set_by_route(route, api_ctx) local new_nodes, err = dis.nodes(up_conf.service_name) if not new_nodes then -return http_code_upstream_unavailable, "no valid upstream node: " .. (err or "nil") +return HTTP_CODE_UPSTREAM_UNAVAILABLE, "no valid upstream node: " .. (err or "nil") end local same = upstream_util.compare_upstream_node(up_conf, new_nodes) @@ -243,7 +243,7 @@ function _M.set_by_route(route, api_ctx) local nodes_count = up_conf.nodes and #up_conf.nodes or 0 if nodes_count == 0 then -return http_code_upstream_unavailable, "no valid upstream node" +return HTTP_CODE_UPSTREAM_UNAVAILABLE, "no valid upstream node" end if not is_http then
[apisix-docker] branch master updated: chore: fix spelling (#141)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-docker.git The following commit(s) were added to refs/heads/master by this push: new f198360 chore: fix spelling (#141) f198360 is described below commit f198360372dc73d65b408451082824457c58c48f Author: John Bampton AuthorDate: Sat Feb 27 22:20:39 2021 +1000 chore: fix spelling (#141) --- Makefile | 2 +- all-in-one/apisix-dashboard/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0ffb124..8965cca 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ APISIX_VERSION ?= 2.3 IMAGE_NAME = apache/apisix IMAGE_TAR_NAME = apache_apisix -### build-on-centos: Build apaceh/apisix:xx-centos image +### build-on-centos: Build apache/apisix:xx-centos image build-on-centos: docker build -t $(IMAGE_NAME):$(APISIX_VERSION)-centos -f ./centos/Dockerfile . diff --git a/all-in-one/apisix-dashboard/Dockerfile b/all-in-one/apisix-dashboard/Dockerfile index f15c743..a6a12b9 100644 --- a/all-in-one/apisix-dashboard/Dockerfile +++ b/all-in-one/apisix-dashboard/Dockerfile @@ -41,7 +41,7 @@ RUN wget https://github.com/etcd-io/etcd/releases/download/${ETCD_VERSION}/etcd- && ln -s etcd-${ETCD_VERSION}-linux-amd64 etcd -# Build APISIX Dashboard - 1. downlaod source code from github +# Build APISIX Dashboard - 1. download source code from github FROM alpine:latest as pre-build ARG APISIX_DASHBOARD_VERSION
[apisix-docker] branch master updated: chore: remove unneeded whitespace (#142)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-docker.git The following commit(s) were added to refs/heads/master by this push: new 20e2a6a chore: remove unneeded whitespace (#142) 20e2a6a is described below commit 20e2a6a97c8a3c265232eafb5dc742d914f6306d Author: John Bampton AuthorDate: Sat Feb 27 22:20:09 2021 +1000 chore: remove unneeded whitespace (#142) --- README.md | 4 ++-- all-in-one/apisix-dashboard/conf.yaml | 2 +- build.md | 2 +- example/README.md | 2 +- manual.md | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 45a1a4d..c16fd2a 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,13 @@ ## How To Build Image -**The master branch is for the version of Apache APISIX 2.x . If you need a previous version, please build from the [v1.x](https://github.com/apache/apisix-docker/releases/tag/v1.x) tag.** +**The master branch is for the version of Apache APISIX 2.x. If you need a previous version, please build from the [v1.x](https://github.com/apache/apisix-docker/releases/tag/v1.x) tag.** ### Build an image from source 1. Build from release version: ``` -# Assign Apache release version number to variable `APISIX_VERSION`, for example: 2.2 . The latest version can be find at `https://github.com/apache/apisix/releases` +# Assign Apache release version number to variable `APISIX_VERSION`, for example: 2.2. The latest version can be find at `https://github.com/apache/apisix/releases` export APISIX_VERSION=2.2 docker build -t apisix:${APISIX_VERSION}-alpine --build-arg APISIX_VERSION=${APISIX_VERSION} -f alpine/Dockerfile alpine diff --git a/all-in-one/apisix-dashboard/conf.yaml b/all-in-one/apisix-dashboard/conf.yaml index c70134f..9106e20 100644 --- a/all-in-one/apisix-dashboard/conf.yaml +++ b/all-in-one/apisix-dashboard/conf.yaml @@ -19,7 +19,7 @@ authentication: secret: secret # secret for jwt token generation. # NOTE: Highly recommended to modify this value to protect `manager api`. -# if it's default value, when `manager api` start , it will generate a random string to replace it. +# if it's default value, when `manager api` start, it will generate a random string to replace it. expire_time: 3600 # jwt token expire time, in second users: - username: admin # username and password for login `manager api` diff --git a/build.md b/build.md index f4fe53a..00e633a 100644 --- a/build.md +++ b/build.md @@ -4,7 +4,7 @@ 1. install release version (Apache releases are beginning from version 0.9): ``` -# Assign Apache release version number to variable `APISIX_VERSION`, for example: 2.2 . The latest version can be find at `https://github.com/apache/apisix/releases` +# Assign Apache release version number to variable `APISIX_VERSION`, for example: 2.2. The latest version can be find at `https://github.com/apache/apisix/releases` APISIX_VERSION=2.2 docker build -t apisix:${APISIX_VERSION}-alpine --build-arg APISIX_VERSION=${APISIX_VERSION} -f alpine/Dockerfile alpine diff --git a/example/README.md b/example/README.md index ef9fdab..8fdc676 100644 --- a/example/README.md +++ b/example/README.md @@ -1,4 +1,4 @@ -**This example is used for functional verification and is not recommended for performance testing. For performance testing, please refer to [benchmark](https://github.com/apache/apisix#benchmark) .** +**This example is used for functional verification and is not recommended for performance testing. For performance testing, please refer to [benchmark](https://github.com/apache/apisix#benchmark).** ### Run diff --git a/manual.md b/manual.md index 77c8b90..156eb66 100644 --- a/manual.md +++ b/manual.md @@ -58,7 +58,7 @@ docker run --name test-api-gateway \ Test with admin api -e.g. Get route list, should be return +e.g. Get route list, should be return ``` curl http://127.0.0.1:9080/apisix/admin/routes/
[apisix-helm-chart] branch master updated: chore: remove unneeded trailing whitespace (#35)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git The following commit(s) were added to refs/heads/master by this push: new 6eed5b1 chore: remove unneeded trailing whitespace (#35) 6eed5b1 is described below commit 6eed5b1987f32481ae2e2102849ad186b798014c Author: John Bampton AuthorDate: Sat Feb 27 22:18:52 2021 +1000 chore: remove unneeded trailing whitespace (#35) --- charts/apisix/README.md | 2 +- charts/apisix/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/apisix/README.md b/charts/apisix/README.md index 092b532..c246463 100644 --- a/charts/apisix/README.md +++ b/charts/apisix/README.md @@ -21,7 +21,7 @@ ## Dependencies -Update the dependency chart +Update the dependency chart ```shell $ helm repo add bitnami https://charts.bitnami.com/bitnami diff --git a/charts/apisix/values.yaml b/charts/apisix/values.yaml index 50f8535..e2b94b3 100644 --- a/charts/apisix/values.yaml +++ b/charts/apisix/values.yaml @@ -190,5 +190,5 @@ nodeSelector: {} tolerations: [] -affinity: +affinity: enabled: false
[apisix] branch master updated: chore: add safe limit to avoid infinite loop caused by bug (#3682)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 3950e4a chore: add safe limit to avoid infinite loop caused by bug (#3682) 3950e4a is described below commit 3950e4a781b2d11bee5ecf4d62229d0a36ce36ff Author: 罗泽轩 AuthorDate: Sat Feb 27 20:02:07 2021 +0800 chore: add safe limit to avoid infinite loop caused by bug (#3682) --- apisix/balancer/least_conn.lua | 5 - apisix/balancer/roundrobin.lua | 9 - 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apisix/balancer/least_conn.lua b/apisix/balancer/least_conn.lua index a1d37c7..1cfdbf9 100644 --- a/apisix/balancer/least_conn.lua +++ b/apisix/balancer/least_conn.lua @@ -31,7 +31,10 @@ end function _M.new(up_nodes, upstream) local servers_heap = binaryHeap.minUnique(least_score) +local safe_limit = 0 for server, weight in pairs(up_nodes) do +safe_limit = safe_limit + 1 + local score = 1 / weight -- Note: the argument order of insert is different from others servers_heap:insert({ @@ -47,7 +50,7 @@ function _M.new(up_nodes, upstream) local server, info, err if ctx.balancer_tried_servers then local tried_server_list = {} -while true do +for i = 1, safe_limit do server, info = servers_heap:peek() if server == nil then err = "all upstream servers tried" diff --git a/apisix/balancer/roundrobin.lua b/apisix/balancer/roundrobin.lua index 7d4a374..a9469ca 100644 --- a/apisix/balancer/roundrobin.lua +++ b/apisix/balancer/roundrobin.lua @@ -18,12 +18,19 @@ local roundrobin = require("resty.roundrobin") local core = require("apisix.core") local nkeys = core.table.nkeys +local pairs = pairs local _M = {} function _M.new(up_nodes, upstream) +local safe_limit = 0 +for _, weight in pairs(up_nodes) do +-- the weight can be zero +safe_limit = safe_limit + weight + 1 +end + local picker = roundrobin:new(up_nodes) local nodes_count = nkeys(up_nodes) return { @@ -34,7 +41,7 @@ function _M.new(up_nodes, upstream) end local server, err -while true do +for i = 1, safe_limit do server, err = picker:find() if not server then return nil, err
[apisix] branch master updated (343d484 -> fa028c1)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 343d484 chore: no need to package documentation (#3687) add fa028c1 fix: cache server picker for nodes without port (#3665) No new revisions were added by this update. Summary of changes: apisix/init.lua | 7 +++ apisix/upstream.lua | 31 +++--- apisix/utils/upstream.lua | 7 ++- t/node/upstream-discovery.t | 47 + 4 files changed, 84 insertions(+), 8 deletions(-)
[apisix] branch master updated (0b0a1c5 -> a6fbcce)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 0b0a1c5 docs: fix markdown links (#3622) add a6fbcce fix: script does not work when the route is bound to a service. (#3678) No new revisions were added by this update. Summary of changes: apisix/plugin.lua | 4 +++ t/{node/service-empty.t => script/script.t} | 54 - 2 files changed, 33 insertions(+), 25 deletions(-) copy t/{node/service-empty.t => script/script.t} (67%)
[apisix] branch master updated (e146893 -> 7bef1b1)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from e146893 docs: plugin-develop.md adds ctx and conf descriptions (#3650) add 7bef1b1 feat: don't log uninitialized access log variable when the HTTP request is malformed (#3641) No new revisions were added by this update. Summary of changes: .travis/apisix_cli_test/test_main.sh | 20 +++- apisix/cli/ngx_tpl.lua | 1 + 2 files changed, 20 insertions(+), 1 deletion(-)
[apisix] branch master updated: test: add fuzzing case for the route with serverless-post-function (#3639)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 5591595 test: add fuzzing case for the route with serverless-post-function (#3639) 5591595 is described below commit 55915952282ba4d4d5f807379e3dbd5cbfcaf517 Author: idbeta AuthorDate: Thu Feb 25 09:33:25 2021 +0800 test: add fuzzing case for the route with serverless-post-function (#3639) relate #3340 --- .github/workflows/fuzzing-ci.yaml| 8 +- t/fuzzing/public.py | 2 +- t/fuzzing/serverless_route_test.py | 112 +++ t/fuzzing/{route_test.py => simpleroute_test.py} | 0 4 files changed, 119 insertions(+), 3 deletions(-) diff --git a/.github/workflows/fuzzing-ci.yaml b/.github/workflows/fuzzing-ci.yaml index 1b27660..04b30d1 100644 --- a/.github/workflows/fuzzing-ci.yaml +++ b/.github/workflows/fuzzing-ci.yaml @@ -51,9 +51,13 @@ jobs: run: | pip install typing boofuzz -- name: run test +- name: run simpleroute test run: | -python $PWD/t/fuzzing/route_test.py +python $PWD/t/fuzzing/simpleroute_test.py + +- name: run serverless route test + run: | +python $PWD/t/fuzzing/serverless_route_test.py - name: echo test log # more than 150k lines, so only display the last log, actually, this step is not needed. diff --git a/t/fuzzing/public.py b/t/fuzzing/public.py index e91a49a..00f4ed2 100644 --- a/t/fuzzing/public.py +++ b/t/fuzzing/public.py @@ -29,7 +29,7 @@ def check_log(*logs): apisix_errorlog = logs[1] apisix_accesslog = logs[2] -cmds = ['cat %s | grep -a "fail"'%boofuzz_log, 'cat %s | grep -a "error"'%apisix_errorlog, 'cat %s | grep -a " 500 "'%apisix_accesslog] +cmds = ['cat %s | grep -a "fail"'%boofuzz_log, 'cat %s | grep -a "error" | grep -v "invalid request body"'%apisix_errorlog, 'cat %s | grep -a " 500 "'%apisix_accesslog] for cmd in cmds: r = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) assert r.stdout.read().strip() == "" diff --git a/t/fuzzing/serverless_route_test.py b/t/fuzzing/serverless_route_test.py new file mode 100644 index 000..190ce36 --- /dev/null +++ b/t/fuzzing/serverless_route_test.py @@ -0,0 +1,112 @@ +#! /usr/bin/env python + +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import subprocess +from public import * +from boofuzz import * + +def create_route(): +command = '''curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' +{ +"uri": "/post*", +"methods": ["POST"], +"plugins": { +"serverless-post-function": { +"functions": ["return function()\n local core = require(\"apisix.core\")\n ngx.req.read_body()\nlocal req_body = ngx.req.get_body_data()\nif req_body == \"{\\\"a\\\":\\\"b\\\"}\" then\n return\n else\n ngx.exit(ngx.HTTP_BAD_REQUEST)\n end\n end\n"] +} +}, +"upstream": { +"nodes": { +"127.0.0.1:": 1 +}, +"type": "roundrobin" +} +}' +''' +subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + +def main(): +fw = open(cur_dir() + "/test.log",'wb') +fuzz_loggers = [FuzzLoggerText(file_handle=fw)] +session = Session( +target=Target( +connection=TCPSocketConnection("127.0.0.1", 9080, send_timeout=5.0, recv_timeout=5.0, server=False) +), +fuzz_loggers=fuzz_loggers, +keep_web_open=False, +) + +s_initialize(name="Request") +with s_block(&
[apisix] branch master updated: fix: correct the template of dns_resolver_valid (#3638)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new 7edf9d6 fix: correct the template of dns_resolver_valid (#3638) 7edf9d6 is described below commit 7edf9d6ed49b35059fb966b54348e14029d0d9ba Author: 罗泽轩 AuthorDate: Tue Feb 23 11:59:33 2021 +0800 fix: correct the template of dns_resolver_valid (#3638) --- .travis/apisix_cli_test/test_dns.sh | 61 + apisix/cli/ngx_tpl.lua | 4 +-- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/.travis/apisix_cli_test/test_dns.sh b/.travis/apisix_cli_test/test_dns.sh new file mode 100755 index 000..d1aca15 --- /dev/null +++ b/.travis/apisix_cli_test/test_dns.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# 'make init' operates scripts and related configuration files in the current directory +# The 'apisix' command is a command in the /usr/local/apisix, +# and the configuration file for the operation is in the /usr/local/apisix/conf + +. ./.travis/apisix_cli_test/common.sh + +# dns_resolver_valid +echo ' +apisix: + dns_resolver: +- 127.0.0.1 +- "[::1]:5353" + dns_resolver_valid: 30 +' > conf/config.yaml + +make init + +if ! grep "resolver 127.0.0.1 \[::1\]:5353 valid=30;" conf/nginx.conf > /dev/null; then +echo "failed: dns_resolver_valid doesn't take effect" +exit 1 +fi + +echo ' +apisix: + stream_proxy: +tcp: + - 9100 + dns_resolver: +- 127.0.0.1 +- "[::1]:5353" + dns_resolver_valid: 30 +' > conf/config.yaml + +make init + +count=$(grep -c "resolver 127.0.0.1 \[::1\]:5353 valid=30;" conf/nginx.conf) +if [ "$count" -ne 2 ]; then +echo "failed: dns_resolver_valid doesn't take effect" +exit 1 +fi + +echo "pass: dns_resolver_valid takes effect" diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua index cf0799f..b331b5f 100644 --- a/apisix/cli/ngx_tpl.lua +++ b/apisix/cli/ngx_tpl.lua @@ -65,7 +65,7 @@ stream { lua_shared_dict lrucache-lock-stream 10m; -resolver {% for _, dns_addr in ipairs(dns_resolver or {}) do %} {*dns_addr*} {% end %} {% if dns_resolver_valid then %}valid={*dns_resolver_valid*}{% end %}; +resolver {% for _, dns_addr in ipairs(dns_resolver or {}) do %} {*dns_addr*} {% end %} {% if dns_resolver_valid then %} valid={*dns_resolver_valid*}{% end %}; resolver_timeout {*resolver_timeout*}; # stream configuration snippet starts @@ -187,7 +187,7 @@ http { lua_socket_log_errors off; -resolver {% for _, dns_addr in ipairs(dns_resolver or {}) do %} {*dns_addr*} {% end %} {% if dns_resolver_valid then %}valid={*dns_resolver_valid*}{% end %}; +resolver {% for _, dns_addr in ipairs(dns_resolver or {}) do %} {*dns_addr*} {% end %} {% if dns_resolver_valid then %} valid={*dns_resolver_valid*}{% end %}; resolver_timeout {*resolver_timeout*}; lua_http10_buffering off;
[apisix-dashboard] branch master updated: chore: update doc about JSONSchema sync and remove useless codes (#1486)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git The following commit(s) were added to refs/heads/master by this push: new eba0868 chore: update doc about JSONSchema sync and remove useless codes (#1486) eba0868 is described below commit eba0868ae13696753caf2ae028fc24ec1d014b8c Author: nic-chen <33000667+nic-c...@users.noreply.github.com> AuthorDate: Mon Feb 22 23:57:26 2021 +0800 chore: update doc about JSONSchema sync and remove useless codes (#1486) close #1443 --- api/build-tools/json.lua| 400 api/build-tools/schema-sync.lua | 160 api/build-tools/schema-sync.sh | 49 - api/test/docker/Dockerfile | 2 - docs/FAQ.md | 22 +-- docs/deploy.md | 16 ++ 6 files changed, 25 insertions(+), 624 deletions(-) diff --git a/api/build-tools/json.lua b/api/build-tools/json.lua deleted file mode 100644 index 720b029..000 --- a/api/build-tools/json.lua +++ /dev/null @@ -1,400 +0,0 @@ --- --- json.lua --- --- Copyright (c) 2020 rxi --- --- Permission is hereby granted, free of charge, to any person obtaining a copy of --- this software and associated documentation files (the "Software"), to deal in --- the Software without restriction, including without limitation the rights to --- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies --- of the Software, and to permit persons to whom the Software is furnished to do --- so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in all --- copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --- SOFTWARE. --- -local string = string -local error= error -local rawget = rawget -local next = next -local pairs= pairs -local type = type -local ipairs = ipairs -local table= table -local math = math -local tostring = tostring -local select = select -local tonumber = tonumber - -local json = { _version = "0.1.2" } - --- Encode - -local encode - -local escape_char_map = { - [ "\\" ] = "\\", - [ "\"" ] = "\"", - [ "\b" ] = "b", - [ "\f" ] = "f", - [ "\n" ] = "n", - [ "\r" ] = "r", - [ "\t" ] = "t", -} - -local escape_char_map_inv = { [ "/" ] = "/" } -for k, v in pairs(escape_char_map) do - escape_char_map_inv[v] = k -end - - -local function escape_char(c) - return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte())) -end - - -local function encode_nil(val) - return "null" -end - - -local function encode_table(val, stack) - local res = {} - stack = stack or {} - - -- Circular reference? - if stack[val] then error("circular reference") end - - stack[val] = true - - if rawget(val, 1) ~= nil or next(val) == nil then --- Treat as array -- check keys are valid and it is not sparse -local n = 0 -for k in pairs(val) do - if type(k) ~= "number" then -error("invalid table: mixed or invalid key types") - end - n = n + 1 -end -if n ~= #val then - error("invalid table: sparse array") -end --- Encode -for i, v in ipairs(val) do - table.insert(res, encode(v, stack)) -end -stack[val] = nil -return "[" .. table.concat(res, ",") .. "]" - - else --- Treat as an object -for k, v in pairs(val) do - if type(k) ~= "string" then -error("invalid table: mixed or invalid key types") - end - table.insert(res, encode(k, stack) .. ":" .. encode(v, stack)) -end -stack[val] = nil -return "{" .. table.concat(res, ",") .. "}" - end -end - - -local function encode_string(val) - return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"' -end - - -local function encode_number(val) - -- Check for NaN, -inf and inf - if val ~= val or val <
[apisix] branch master updated: feat: translate the README to Spanish (#3597)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git The following commit(s) were added to refs/heads/master by this push: new fb83857 feat: translate the README to Spanish (#3597) fb83857 is described below commit fb83857d289acf537a8feb65a1ef633e5c5c3e97 Author: John Bampton AuthorDate: Sun Feb 21 12:50:00 2021 +1000 feat: translate the README to Spanish (#3597) The Spanish translation work was done by Jorge > @summerhill5 refs #3587 --- .github/workflows/misc-checker.yml | 2 +- README_ES.md | 344 + 2 files changed, 345 insertions(+), 1 deletion(-) diff --git a/.github/workflows/misc-checker.yml b/.github/workflows/misc-checker.yml index 1ec12ef..146d2f6 100644 --- a/.github/workflows/misc-checker.yml +++ b/.github/workflows/misc-checker.yml @@ -14,7 +14,7 @@ jobs: wget -O - -q https://git.io/misspell | sh -s -- -b . - name: Misspell run: | - find *.md apisix doc bin t -not -path "t/toolkit/*.lua" -type f | xargs ./misspell -error + find *.md apisix doc bin t -not -path "README_ES.md" -not -path "t/toolkit/*.lua" -type f | xargs ./misspell -error - name: Merge conflict run: | grep "^<<<<<<< HEAD" $(git ls-files | grep -v "t/toolkit" | xargs) && exit 1 || true diff --git a/README_ES.md b/README_ES.md new file mode 100644 index 000..c49ab2c --- /dev/null +++ b/README_ES.md @@ -0,0 +1,344 @@ + + +# Apache APISIX + +https://svn.apache.org/repos/asf/comdev/project-logos/originals/apisix.svg"; alt="APISIX logo" height="150px" align="right" /> + +[![Build Status](https://github.com/apache/apisix/workflows/build/badge.svg?branch=master)](https://github.com/apache/apisix/actions) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/apache/apisix/blob/master/LICENSE) + +**Apache APISIX** es un portal API en tiempo real, dinámico y de alto rendimiento. + +APISIX proporciona variadas opciones de manejo de tráfico tales como balanceo de cargas, upstream dinámico, comprobación tipo despliegue de canarios (canary release), interrupción de circuitos, autenticación, observabilidad y más. + +Usted puede usar Apache APISIX para manejar el tráfico tradicional norte-sur, +así como tráfico este-oeste entre servicios. +También puede usarse como [k8s ingress controller (control de ingreso)](https://github.com/apache/apisix-ingress-controller). + +La arquitectura técnica de Apache APISIX: + +![](doc/images/apisix.png) + +## Communidad + +- Lista de Correos: Enviar correos a dev-subscr...@apisix.apache.org, luego siga la respuesta para suscribirse a la Lista de Correos. +- QQ Group - 578997126 +- [Slack Workspace](http://s.apache.org/slack-invite) - únase a `#apisix` en nuestro Slack para encontrarse con el equipo y formular preguntas +- ![Twitter Follow](https://img.shields.io/twitter/follow/ApacheAPISIX?style=social) - síganos e interactúe con nosotros usando hashtag `#ApacheAPISIX` +- [bilibili video](https://space.bilibili.com/551921247) +- **Good first issues**: + - [Apache APISIX](https://github.com/apache/apisix/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) + - [Controlador de ingreso Apache APISIX](https://github.com/apache/apisix-ingress-controller/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) + - [Tablero Apache APISIX](https://github.com/apache/apisix-dashboard/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) + - [Carta Helm Apache APISIX](https://github.com/apache/apisix-helm-chart/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) + - [Distribución de Dockers para APISIX](https://github.com/apache/apisix-docker/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) + - [Sitio Web Apache APISIX](https://github.com/apache/apisix-website/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) + - [El Plano de Control para APISIX](https://github.com/apache/apisix-control-plane/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) + +## Características + +Usted puede usar Apache APISIX como un acceso de tráfico para procesar todos los datos del negocio, incluyendo direccionamiento dinámico (dynamic routing), upstream dinámico, certificados dinámicos, +ensayos A/B, ensayos de despliegue de canarios (canary release), despliegue azul-verde (blue-green), límite de tasa, defensa contra ataques maliciosos, métrica, monitoreo de alarmas, visibilidad de servicios, gobernabilidad de servicios, etc. + +- **Todas las Plataformas** + + - Nativo de la Nube: Agnóstico de Plataforma, libre de restricciones del vendedor, APISIX puede ejecutarse desde metal desnudo hasta Kuberne
[apisix] branch master updated (bee574f -> 013db0d)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from bee574f fix: use openssl111 in openresty dir in precedence (#3603) add 013db0d feat: support to bind plugin config by `plugin_config_id` (#3567) No new revisions were added by this update. Summary of changes: apisix/admin/init.lua | 1 + .../admin/{global_rules.lua => plugin_config.lua} | 31 +- apisix/admin/routes.lua| 17 + apisix/cli/etcd.lua| 2 +- apisix/init.lua| 14 + apisix/plugin_config.lua | 71 apisix/plugins/example-plugin.lua | 4 +- apisix/router.lua | 3 + apisix/schema_def.lua | 19 +- doc/admin-api.md | 30 ++ doc/architecture-design.md | 124 +++ doc/zh-cn/admin-api.md | 34 ++ doc/zh-cn/architecture-design.md | 123 +++ t/admin/{global-rules.t => plugin-configs.t} | 362 +++-- t/admin/routes2.t | 34 ++ .../{global-rule.t => plugin-configs.t}| 118 --- t/config-center-yaml/route.t | 22 ++ t/lib/test_admin.lua | 17 +- t/node/plugin-configs.t| 125 +++ t/plugin/example.t | 4 +- 20 files changed, 759 insertions(+), 396 deletions(-) copy apisix/admin/{global_rules.lua => plugin_config.lua} (80%) create mode 100644 apisix/plugin_config.lua copy t/admin/{global-rules.t => plugin-configs.t} (50%) copy t/config-center-yaml/{global-rule.t => plugin-configs.t} (55%) create mode 100644 t/node/plugin-configs.t
[apisix-dashboard] branch docs-main-image updated (f26643a -> 4e6ac5f)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch docs-main-image in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git. from f26643a docs: update architecture diagram. add 1804c75 fix: cli test failed (#1475) add adda38b feat: Press Enter key can trigger the Login button (#1472) add 1d8a853 docs: update Release info & Makefile tip (#1478) add 20d5492 feat: add a GitHub Action to check for trailing whitespace (#1474) add 2b9ff48 feat: added tip for Plugin module (#1481) add 65f792a feat: added tip on the Metrics page (#1479) add 4e6ac5f Merge branch 'master' into docs-main-image No new revisions were added by this update. Summary of changes: .github/workflows/lint.yml | 27 - .github/workflows/spellchecker.yml | 21 Makefile | 12 +- README.md | 2 +- .../handler/data_loader/route_export_test.go | 72 ++-- api/test/e2e/route_export_test.go | 124 ++--- api/test/e2e/service_test.go | 28 ++--- api/test/shell/cli_test.sh | 3 +- api/test/shell/manager_smoking.sh | 6 +- web/cypress/fixtures/selector.json | 8 +- .../integration/metrics/metrics-smoketest.spec.js | 2 +- web/cypress/integration/user/login.spec.js | 30 +++-- web/src/components/Plugin/PluginPage.tsx | 12 ++ .../{pages => components}/Plugin/locales/en-US.ts | 4 +- .../{ActionBar => Plugin}/locales/zh-CN.ts | 4 +- web/src/components/RightContent/index.tsx | 2 +- web/src/locales/en-US.ts | 2 + web/src/locales/zh-CN.ts | 2 + web/src/pages/Metrics/Metrics.tsx | 14 ++- web/src/pages/Metrics/locales/en-US.ts | 3 +- web/src/pages/Metrics/locales/zh-CN.ts | 1 + web/src/pages/ServerInfo/typing.d.ts | 2 +- web/src/pages/User/Login.tsx | 8 +- 23 files changed, 219 insertions(+), 170 deletions(-) delete mode 100644 .github/workflows/spellchecker.yml copy web/src/{pages => components}/Plugin/locales/en-US.ts (85%) copy web/src/components/{ActionBar => Plugin}/locales/zh-CN.ts (83%)
[apisix] branch master updated (7dde426 -> bee574f)
This is an automated email from the ASF dual-hosted git repository. membphis pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/apisix.git. from 7dde426 refactor: remove unused core.http (#3555) add bee574f fix: use openssl111 in openresty dir in precedence (#3603) No new revisions were added by this update. Summary of changes: .github/workflows/fuzzing-ci.yaml | 2 +- Makefile | 18 -- doc/install-dependencies.md | 12 +++- doc/zh-cn/install-dependencies.md | 12 +++- utils/centos7-ci.sh | 2 +- utils/linux-install-luarocks.sh | 11 +-- utils/linux-install-openresty.sh | 10 -- 7 files changed, 45 insertions(+), 22 deletions(-)