guilhermevillote commented on issue #12349:
URL: https://github.com/apache/apisix/issues/12349#issuecomment-2986451687

   Thanks for the suggestion!
   
   I checked ctx.matched_route, and it does include the route metadata, but the 
plugins field only shows a shallow reference like this:
   
   ```json
               "matched_route": {
                   "value": {
                       "id": "398c7dd4",
                       "priority": 0,
                       "upstream_id": "52c52e36",
                       "name": "apisix-ingress_admin-teste_main",
                       "hosts": [
                           "xxx"
                       ],
                       "labels": {
                           "managed-by": "apisix-ingress-controller",
                       },
                       "uris": [
                           "/admin/teste/*"
                       ],
                       "desc": "Created by apisix-ingress-controller, DO NOT 
modify it manually",
                       "status": 1,
                       "plugins": {
                           "acl": "table: 0x78bafb3d9410",
                           "proxy-rewrite": "table: 0x78baf5abada0",
                           "key-auth": "table: 0x78bafb3d9318"
                       },
                       "update_time": 1750219153,
                       "create_time": 1750218190
                   },
                   "orig_modifiedIndex": 1167,
                   "has_domain": false,
                   "createdIndex": 1141,
                   "modifiedIndex": 1167,
                   "clean_handlers": {},
                   "key": "/apisix/routes/398c7dd4"
               },
   ```
   
   So I don’t have direct access to the actual plugin config values — just Lua 
table references as strings.
   Is there a recommended way to dereference these or access the actual plugin 
configuration defined on the route from within the plugin logic?
   
   Again, my use case is:
   
   I need to access the route-level plugin configuration, even when the plugin 
is also configured on the consumer — which is where the current conf value 
comes from during the access phase.
   
   I considered doing a manual fetch of the route-level plugin configuration 
based on something like the plugin ID or Lua table reference, but I’m concerned 
this could introduce unnecessary latency into the request path.
   
   I also tried using the rewrite phase with type = "auth" (to skip 
rewrite_in_consumer), and this does provide access to the route-level plugin 
config.
   
   However, I’m concerned that this might mix responsibilities — according to 
the docs, type = "auth" is intended for authentication plugins, whereas mine is 
for authorization. It doesn’t handle consumer attachment itself, but instead 
relies on the ctx.consumer set by authentication plugins like key-auth.
   
   Is there a built-in or efficient way to retrieve the route-level plugin 
config within the access phase?
   Or is using the rewrite phase with type = "auth" the recommended approach in 
this case?
   
   Thanks again!
   


-- 
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-unsubscr...@apisix.apache.org

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

Reply via email to