tokers commented on code in PR #9534:
URL: https://github.com/apache/apisix/pull/9534#discussion_r1205147141


##########
apisix/http/route.lua:
##########
@@ -31,6 +31,23 @@ local loadstring = loadstring
 local _M = {}
 
 
+function _M.prefix_uris(route, service)
+    if service and service.value.path_prefix then
+        local uri, uris
+        if route.value.uris then
+            uris = core.table.new(#route.value.uris)
+            for _, uri in ipairs(route.value.uris) do
+                core.table.insert(uris, service.value.path_prefix .. uri)

Review Comment:
   A tiny detail: what if the path_prefix is ended with `/`, in such a case, 
we'll have continuous slashes. E.g., `/api/v1//order`. While this affects the 
route match?



##########
apisix/init.lua:
##########
@@ -640,6 +641,14 @@ function _M.http_access_phase()
             enable_websocket = service.value.enable_websocket
         end
 
+        if route.value.strip_path_prefix and service.value.path_prefix then
+            local uri = api_ctx.var.uri
+            if uri:find(service.value.path_prefix) == 1 then

Review Comment:
   Why not using `core.string.has_prefix`?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to