diff --git a/apisix/plugins/proxy-rewrite.lua b/apisix/plugins/proxy-rewrite.lua index 29e8f5f02863..6424576bca44 100644 --- a/apisix/plugins/proxy-rewrite.lua +++ b/apisix/plugins/proxy-rewrite.lua @@ -22,9 +22,11 @@ local ipairs = ipairs local ngx = ngx local type = type local re_sub = ngx.re.sub +local re_gsub = ngx.re.gsub local re_match = ngx.re.match local req_set_uri = ngx.req.set_uri local sub_str = string.sub +local str_gsub = string.gsub local str_find = core.string.find local switch_map = {GET = ngx.HTTP_GET, POST = ngx.HTTP_POST, PUT = ngx.HTTP_PUT, @@ -44,6 +46,26 @@ local lrucache = core.lrucache.new({ type = "plugin", }) +local nginx_var_pattern = [[(?= 300 then + ngx.status = code + end + ngx.say(body) + } + } +--- request +GET /t +--- response_body +passed + + + +=== TEST 2: hit route(regex_uri resolves capture and NGINX variable) +--- request +GET /api/team?name=alice HTTP/1.1 +--- response_body +uri: /plugin_proxy_rewrite_args +c: team +l: $x +n: alice +name: alice