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/incubator-apisix.git
The following commit(s) were added to refs/heads/master by this push: new 33699f8 bugfix(proxy-rewrite): Invalid pattern. (#1267) 33699f8 is described below commit 33699f840765cbf7d2282a75ff6360694e9a1020 Author: YuanSheng Wang <membp...@gmail.com> AuthorDate: Sat Mar 14 22:19:13 2020 +0800 bugfix(proxy-rewrite): Invalid pattern. (#1267) Fix #1263 --- lua/apisix/plugins/proxy-rewrite.lua | 2 +- t/plugin/proxy-rewrite.t | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lua/apisix/plugins/proxy-rewrite.lua b/lua/apisix/plugins/proxy-rewrite.lua index cc1af62..0fd01ee 100644 --- a/lua/apisix/plugins/proxy-rewrite.lua +++ b/lua/apisix/plugins/proxy-rewrite.lua @@ -31,7 +31,7 @@ local schema = { type = "string", minLength = 1, maxLength = 4096, - pattern = "^/.*", + pattern = [[^\/.*]], }, regex_uri = { description = "new uri that substitute from client uri " .. diff --git a/t/plugin/proxy-rewrite.t b/t/plugin/proxy-rewrite.t index f7e7afd..3d12787 100644 --- a/t/plugin/proxy-rewrite.t +++ b/t/plugin/proxy-rewrite.t @@ -1006,3 +1006,28 @@ GET /t qr/failed to match pattern/ --- no_error_log [error] + + + +=== TEST 35: wrong value of uri +--- config + location /t { + content_by_lua_block { + local plugin = require("apisix.plugins.proxy-rewrite") + local ok, err = plugin.check_schema({ + uri = 'home' + }) + if not ok then + ngx.say(err) + return + end + + ngx.say("done") + } + } +--- request +GET /t +--- response_body +property "uri" validation failed: failed to match pattern "^\\/.*" with "home" +--- no_error_log +[error]