You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "RangoStack (via GitHub)" <gi...@apache.org> on 2023/05/30 00:51:39 UTC

[GitHub] [apisix] RangoStack opened a new issue, #9570: help request: 自定义插件

RangoStack opened a new issue, #9570:
URL: https://github.com/apache/apisix/issues/9570

   ### Description
   
   自定义插件怎么获取到请求的route_id呢?
   ngx.ctx.api_ctx.route_id这种方式获取到的route_id与实际请求的route_id不一致的情况。
   
   ### Environment
   
   - APISIX version (run `apisix version`):
   - Operating system (run `uname -a`):
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
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.apache.org

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


Re: [I] help request: how to get route_id [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #9570:
URL: https://github.com/apache/apisix/issues/9570#issuecomment-1750325925

   This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.


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


Re: [I] help request: how to get route_id [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #9570:
URL: https://github.com/apache/apisix/issues/9570#issuecomment-1744637047

   Due to lack of the reporter's response this issue has been labeled with "no response". It will be close in 3 days if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


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


[GitHub] [apisix] lingsamuel commented on issue #9570: help request: how to get route_id

Posted by "lingsamuel (via GitHub)" <gi...@apache.org>.
lingsamuel commented on issue #9570:
URL: https://github.com/apache/apisix/issues/9570#issuecomment-1611035935

   Please give a minimal reproducible example. I can't repro this on my side.
   
   Here is my reproduce way with APISIX  3.2
   1. edit request-id plugin
   ```diff
   function _M.header_filter(conf, ctx)
       if not conf.include_in_response then
           return
       end
   
   +   core.log.info("request-id got route_id: ", ngx.ctx.api_ctx.route_id)
       local headers = ngx.resp.get_headers()
       if not headers[conf.header_name] then
           core.response.set_header(conf.header_name, ctx["request-id-" .. conf.header_name])
       end
   end
   ```
   
   2. generate many routes
   ![image](https://github.com/apache/apisix/assets/14567045/d1ef33c7-21ff-4312-8399-e970343dd8da)
   
   3. create a simple route with request-id plugin
   ```bash
   curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '{
       "uri": "/*",
       "plugins": {
           "request-id": {
            }
       },
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "baidu.com:80": 1
           }
       }
   }'
   ```
   
   4. query the route multiple times
   ![image](https://github.com/apache/apisix/assets/14567045/d315ac33-44b7-479b-8bf5-cd7576401784)
   


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


[GitHub] [apisix] moonming commented on issue #9570: help request: how to get route_id

Posted by "moonming (via GitHub)" <gi...@apache.org>.
moonming commented on issue #9570:
URL: https://github.com/apache/apisix/issues/9570#issuecomment-1608773390

   @RangoStack Please use English in the public channel, thx
   Back to your question, can you provide reproduction steps? How do check the route id is not the ngx.ctx.api_ctx.route_id?


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


[GitHub] [apisix] Revolyssup commented on issue #9570: help request: how to get route_id

Posted by "Revolyssup (via GitHub)" <gi...@apache.org>.
Revolyssup commented on issue #9570:
URL: https://github.com/apache/apisix/issues/9570#issuecomment-1602100134

   @RangoStack Can you elaborate further? In which plugin are you trying to access the route id? 


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


Re: [I] help request: how to get route_id [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #9570: help request: how to get route_id
URL: https://github.com/apache/apisix/issues/9570


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