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 2020/11/17 08:48:19 UTC

[GitHub] [apisix] aijunziaixifu opened a new issue #2774: request help: 高级路由配置

aijunziaixifu opened a new issue #2774:
URL: https://github.com/apache/apisix/issues/2774


   ### Issue description
   
   
   ### Environment
   
   * apisix-version:2.0
   * OS:centos 7
   
   请问一下,高级路由配置的请求参数选项,其参数值是从body获取还是,路径获取,是否有解析body的插件呢
   ![image](https://user-images.githubusercontent.com/26455949/99367223-a62c8980-28f4-11eb-9565-dae00e504d08.png)
   


----------------------------------------------------------------
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 #2774: request help: Advanced routing settings

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


   


----------------------------------------------------------------
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] tokers commented on issue #2774: request help: Advanced routing settings

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


   > Hi, @aijunziaixifu, As the @spacewander answered in #2763, you can write your filter function.
   > 
   > Here, I give you an example, you can have a try.
   > 
   > ```
   > curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '{
   >     "uri": "/index.html",
   >     "methods": ["PUT", "GET"],
   >     "upstream": {
   >         "type": "roundrobin",
   >         "nodes": {
   >             "39.97.63.215:80": 1
   >         }
   >     },
   >     "filter_func": "function(vars)
   >     local core = require (\"apisix.core\")
   >     local body, err = core.request.get_body()
   >     if not body then
   >         return false
   >     end
   > 
   >     local data, err = core.json.decode(body)
   >     if not data then
   >         return false
   >     end
   > 
   >     if data[\"a\"] == \"b\" then
   >         return true
   >     end
   > 
   >     return false
   > end"
   > }'
   > ```
   > 
   > By the way, I had seen many people have questions about this. May I add this to the document?
   
   That can be classified as one section of "Apache APISIX Best Practices".


----------------------------------------------------------------
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] membphis commented on issue #2774: request help: 高级路由配置

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


   @aijunziaixifu please use English in public channel


----------------------------------------------------------------
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] starsz commented on issue #2774: request help: Advanced routing settings

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


   Hi, @aijunziaixifu, As the @spacewander answered in https://github.com/apache/apisix/issues/2763, you can write your filter function.
   
   Here, I give you an example, you can have a try.
   ```
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '{
       "uri": "/index.html",
       "methods": ["PUT", "GET"],
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "39.97.63.215:80": 1
           }
       },
       "filter_func": "function(vars)
       local core = require (\"apisix.core\")
       local body, err = core.request.get_body()
       if not body then
           return false
       end
   
       local data, err = core.json.decode(body)
       if not data then
           return false
       end
   
       if data[\"a\"] == \"b\" then
           return true
       end
   
       return false
   end"
   }'
   ```
   
   By the way, I had seen many people have questions about this. May I add this to the document?


----------------------------------------------------------------
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] idbeta commented on issue #2774: request help: 高级路由配置

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


   @aijunziaixifu You can read about `var` in [here](https://github.com/apache/apisix/blob/master/doc/zh-cn/admin-api.md )


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