Sn0rt commented on code in PR #9388:
URL: https://github.com/apache/apisix/pull/9388#discussion_r1187381126


##########
apisix/init.lua:
##########
@@ -688,6 +689,13 @@ function _M.grpc_access_phase()
         core.log.error("failed to set grpcs upstream param: ", err)
         core.response.exit(code)
     end
+
+    if api_ctx.var.upstream_mirror_scheme == "grpc" or
+        api_ctx.var.upstream_mirror_scheme == "grpcs" then
+        if has_mod then
+            apisix_ngx_client.enable_mirror()
+        end
+    end

Review Comment:
   You are right, if you want to support the plug-in list like http, the code 
may look like the following.
   
   ```diff
   diff --git a/apisix/init.lua b/apisix/init.lua
   index 56228670..f4ed438c 100644
   --- a/apisix/init.lua
   +++ b/apisix/init.lua
   @@ -690,12 +690,20 @@ function _M.grpc_access_phase()
            core.response.exit(code)
        end
   
   -    if api_ctx.var.upstream_mirror_scheme == "grpc" or
   -        api_ctx.var.upstream_mirror_scheme == "grpcs" then
   -        if has_mod then
   -            apisix_ngx_client.enable_mirror()
   -        end
   +    local route = api_ctx.matched_route
   +    if not route then
   +        core.log.info("not find any matched route")
   +        return core.response.exit(404,
   +                    {error_msg = "404 Route Not Found"})
        end
   +
   +    core.log.info("matched route: ",
   +            core.json.delay_encode(api_ctx.matched_route, true))
   +
   +    local plugins = plugin.filter(api_ctx, route)
   +    api_ctx.plugins = plugins
   +
   +    plugin.run_plugin("rewrite", plugins, api_ctx)
    end
   
   ```



-- 
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