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/11/02 03:34:11 UTC

[GitHub] [apisix] bzp2010 opened a new issue #5399: Proposal: support advanced matching based on POST form

bzp2010 opened a new issue #5399:
URL: https://github.com/apache/apisix/issues/5399


   # Proposal
   
   ## Background 
   
   Currently, advanced matching only uses URL query data when matching on request content, and does not support advanced matching with fields in POST form as conditions.
   
   ## Objectives
   
   Support for POST form as matching conditions by adding new matching key.
   
   ## Solutions 
   
   ### Determine the added matching key prefix
   
   I think we can add a new `post_arg_` prefix as a POST form data prefix, this is similar to the `arg_` used in the query parameter currently provided by openresty.
   
   ### Modify the mt metatable in `ctx.lua` and add a new key processor
   
   The main purpose of the current modification is to handle POST form submissions with `Content-Type x-www-form-urlencoded`.
   
   Use `ngx.req.read_body()` and fetch data from `ngx.req.get_post_args()` according to read requirements in the metatable to achieve complete on-demand inert loading with the help of the metatable feature. The currently used `lua-resty-expr` can automatically get the target value and compare it with the meta table based on the expression.
   
   current `arg_`: 
   [https://github.com/apache/apisix/blob/042ce5c1a6a4e040d6d6924f2d86e5534b730134/apisix/core/ctx.lua#L167-L176](https://github.com/apache/apisix/blob/042ce5c1a6a4e040d6d6924f2d86e5534b730134/apisix/core/ctx.lua#L167-L176)
   
   demo: 
   ```lua
   if core_str.has_prefix(key,"post_arg_") then
     ngx.req.read_body()
     local args, err = ngx.req.get_post_args()
     loacl post_arg_key = sub_str(key, 10)
     val = args[post_arg_key]
   ```
   
   ## Pre-fetching modifications
   
   1. `apisix/core/ctx.lua`: Add new key processor
   2. `t/*`: Add test case
   3. Add documents for new function
   4. Optional: Add support for its configuration to the Dashboard
   
   ## Other
   
   What are your ideas?


-- 
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] tzssangglass commented on issue #5399: Proposal: support advanced matching based on POST form

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


   > @tzssangglass 那还是只能用serverless解决body字段路由的问题了~ 希望可以支持下。。。
   
   can you submit a new issue about support this?


-- 
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] tzssangglass commented on issue #5399: Proposal: support advanced matching based on POST form

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


   +1, useful


-- 
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 #5399: Proposal: support advanced matching based on POST form

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


   +1, Proposal LGTM.


-- 
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 #5399: Proposal: support advanced matching based on POST form

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


   +1, Proposal LGTM.


-- 
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] tzssangglass commented on issue #5399: Proposal: support advanced matching based on POST form

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


   +1, useful


-- 
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] spacewander closed issue #5399: Proposal: support advanced matching based on POST form

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


   


-- 
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 #5399: Proposal: support advanced matching based on POST form

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


   +1, Proposal LGTM.


-- 
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] tzssangglass commented on issue #5399: Proposal: support advanced matching based on POST form

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


   not support yet, here:https://github.com/apache/apisix/blob/cc43b9fc1bf9be14c05d36415f83cdd189d0a7f5/apisix/core/ctx.lua#L186
   
   json is nested and complicated.


-- 
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] jagerzhang commented on issue #5399: Proposal: support advanced matching based on POST form

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


   @tzssangglass 那还是只能用serverless解决body字段路由的问题了~ 希望可以支持下。。。


-- 
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] tzssangglass commented on issue #5399: Proposal: support advanced matching based on POST form

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


   +1, useful


-- 
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] jagerzhang commented on issue #5399: Proposal: support advanced matching based on POST form

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


   请教下,这个新增特性是否支持content-type=application/json的POST请求中的body过滤?
   目前我们是通过 serverless-pre来实现的,如果这个特性能支持,那就更优雅了。


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