You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/05/28 02:03:40 UTC

[GitHub] [apisix] vincentwc opened a new issue #4328: request help: 怎么实现自定义路由?

vincentwc opened a new issue #4328:
URL: https://github.com/apache/apisix/issues/4328


   ### 我现在想在创建路由的时候给路由的key添加一个字符串该怎么实现
   看了一下etcd里面路由的存储,key都是  /apisix/routes/85这样的,现在想对这个做一些扩展,/apisix/routes/{String}/85
   该怎么实现?
   目前的思路是在请求头里面添加一个k/v,然后再apisix里面怎么解析出来并在routes.lua里面使用?
   目前的想法是将k/v放到ngx.ctx里面,但是之前没做过,所以不知道该怎么实现,可以该我个实现说明吗
   
   ### Environment
   
   Request help without environment information will be ignored or closed.
   
   * apisix version (cmd: `apisix version`):
   * OS (cmd: `uname -a`):
   * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   * etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   * apisix-dashboard version, if have:
   * luarocks version, if the issue is about installation (cmd: `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.

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



[GitHub] [apisix] spacewander closed issue #4328: request help: How to implement custom routing?

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #4328:
URL: https://github.com/apache/apisix/issues/4328


   


-- 
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] vincentwc commented on issue #4328: request help: 怎么实现自定义路由?

Posted by GitBox <gi...@apache.org>.
vincentwc commented on issue #4328:
URL: https://github.com/apache/apisix/issues/4328#issuecomment-850078587


   > As far as I am concerned, it is not recommended to modify the structure of `key`. Because this may bring a series of problems. For example: it cannot be compatible with APISIX in the community, cannot be used with `APISIX Dashboard`, etc.
   
   i know your concerned,but now i want to seperate by api group, so i need to add string at route's key. i think we can't reply it by dashboard?so how to implemets it by apisix not dashboard? 


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

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



[GitHub] [apisix] vincentwc commented on issue #4328: request help: 怎么实现自定义路由?

Posted by GitBox <gi...@apache.org>.
vincentwc commented on issue #4328:
URL: https://github.com/apache/apisix/issues/4328#issuecomment-850148515


   > @vincentwc So you want to separate all routes into multiple groups and distinguish them by the ETCD key prefix?
   >  Yes 
   > I don't know your real scenario but it's not feasible in APISIX, you have to hack it. Also, if the group is used for management, try the labels feature, you can set labels by using apisix-dashboard.
    we should has seperate whit different group , i think we should change  apisix source code, maybe just change route key could implement it,so i init this issue,but know i don't know how to get param in   function _M.get() with routes.lua file. i think could use ngx.ctx to get http request header info and get it at  _M.get()  function, but now i hava no idea how to implement 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.

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



[GitHub] [apisix] Firstsawyou commented on issue #4328: request help: 怎么实现自定义路由?

Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on issue #4328:
URL: https://github.com/apache/apisix/issues/4328#issuecomment-850074745


   As far as I am concerned, it is not recommended to modify the structure of `key`. Because this may bring a series of problems. For example: it cannot be compatible with APISIX in the community, cannot be used with `APISIX Dashboard`, etc.


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

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



[GitHub] [apisix] nanamikon commented on issue #4328: request help: How to implement custom routing?

Posted by GitBox <gi...@apache.org>.
nanamikon commented on issue #4328:
URL: https://github.com/apache/apisix/issues/4328#issuecomment-888742299


   Do you need this feature?
   https://github.com/apache/apisix/blob/master/docs/zh/latest/admin-api.md#route
   ![image](https://user-images.githubusercontent.com/2010632/127419802-638b7026-9ab1-402a-8c33-f2b8480d35cc.png)
   
   You can define a vars matching for your header,   so that you request can be forward to the route。
   
   if you want to separate api group,   may be adding a prefix to the route key work well?  For example,   */apisix/routes/{group-name}-85*.  
   


-- 
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] tokers commented on issue #4328: request help: 怎么实现自定义路由?

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #4328:
URL: https://github.com/apache/apisix/issues/4328#issuecomment-850817375


   > > @vincentwc So you want to separate all routes into multiple groups and distinguish them by the ETCD key prefix?
   > > Yes
   > > I don't know your real scenario but it's not feasible in APISIX, you have to hack it. Also, if the group is used for management, try the labels feature, you can set labels by using apisix-dashboard.
   > > we should has seperate whit different group , i think we should change  apisix source code, maybe just change route key could implement it,so i init this issue,but know i don't know how to get param in   function _M.get() with routes.lua file. i think could use ngx.ctx to get http request header info and get it at  _M.get()  function, but now i hava no idea how to implement it
   
   I'm afraid I didn't capture your meaning. Could you describe it more detailed?


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

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



[GitHub] [apisix] spacewander commented on issue #4328: request help: How to implement custom routing?

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #4328:
URL: https://github.com/apache/apisix/issues/4328#issuecomment-918812930


   Closed as lack of response.


-- 
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] tokers commented on issue #4328: request help: 怎么实现自定义路由?

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #4328:
URL: https://github.com/apache/apisix/issues/4328#issuecomment-850082017


   @vincentwc So you want to separate all routes into multiple groups and distinguish them by the ETCD key prefix?
   
   I don't know your real scenario but it's not feasible in APISIX, you have to hack it. Also, if the group is used for management, try the labels feature, you can set labels by using apisix-dashboard.


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

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