You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "kingluo (via GitHub)" <gi...@apache.org> on 2023/04/12 09:03:31 UTC

[GitHub] [apisix] kingluo commented on a diff in pull request #9194: feat: proxy_rewrite support miltiple regex pattern matching

kingluo commented on code in PR #9194:
URL: https://github.com/apache/apisix/pull/9194#discussion_r1163833279


##########
apisix/plugins/proxy-rewrite.lua:
##########
@@ -14,25 +14,33 @@
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
 --
-local core        = require("apisix.core")
-local plugin_name = "proxy-rewrite"
-local pairs       = pairs
-local ipairs      = ipairs
-local ngx         = ngx
-local type        = type
-local re_sub      = ngx.re.sub
-local re_match    = ngx.re.match
-local sub_str     = string.sub
-local str_find    = core.string.find
-
-local switch_map = {GET = ngx.HTTP_GET, POST = ngx.HTTP_POST, PUT = ngx.HTTP_PUT,
-                    HEAD = ngx.HTTP_HEAD, DELETE = ngx.HTTP_DELETE,
-                    OPTIONS = ngx.HTTP_OPTIONS, MKCOL = ngx.HTTP_MKCOL,
-                    COPY = ngx.HTTP_COPY, MOVE = ngx.HTTP_MOVE,
-                    PROPFIND = ngx.HTTP_PROPFIND, LOCK = ngx.HTTP_LOCK,
-                    UNLOCK = ngx.HTTP_UNLOCK, PATCH = ngx.HTTP_PATCH,
-                    TRACE = ngx.HTTP_TRACE,
-                }
+local core               = require("apisix.core")
+local plugin_name        = "proxy-rewrite"
+local pairs              = pairs
+local ipairs             = ipairs
+local ngx                = ngx
+local type               = type
+local re_sub             = ngx.re.sub
+local re_match           = ngx.re.match
+local sub_str            = string.sub
+local str_find           = core.string.find
+
+local switch_map         = {
+    GET = ngx.HTTP_GET,
+    POST = ngx.HTTP_POST,
+    PUT = ngx.HTTP_PUT,
+    HEAD = ngx.HTTP_HEAD,
+    DELETE = ngx.HTTP_DELETE,
+    OPTIONS = ngx.HTTP_OPTIONS,
+    MKCOL = ngx.HTTP_MKCOL,
+    COPY = ngx.HTTP_COPY,
+    MOVE = ngx.HTTP_MOVE,
+    PROPFIND = ngx.HTTP_PROPFIND,
+    LOCK = ngx.HTTP_LOCK,
+    UNLOCK = ngx.HTTP_UNLOCK,
+    PATCH = ngx.HTTP_PATCH,
+    TRACE = ngx.HTTP_TRACE,
+}

Review Comment:
   Please keep the original indent as much as possible.



##########
apisix/plugins/proxy-rewrite.lua:
##########
@@ -263,109 +274,118 @@ do
     end
 
 
-function _M.rewrite(conf, ctx)
-    for _, name in ipairs(upstream_names) do
-        if conf[name] then
-            ctx.var[upstream_vars[name]] = conf[name]
+    function _M.rewrite(conf, ctx)

Review Comment:
   Don't change the original indent of this file in this PR, which should reflect this feature only.
   If necessary, submit another PR to fix it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org