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 2022/12/16 07:26:27 UTC

[GitHub] [apisix-ingress-controller] Phoebus888 commented on issue #1532: crd是否支持filter_func自定义函数添加

Phoebus888 commented on issue #1532:
URL: https://github.com/apache/apisix-ingress-controller/issues/1532#issuecomment-1354326212

   配置规则为
   ```
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: method-route
     namespace: middle-platform-uat
   spec:
     http:
       - name: method
         match:
           filter_func: "function(vars)\n  local core = require ('apisix.core')\n  local body, err = core.request.get_body()\n  if not body then\n      return false\n  end\n\n  local data, err = core.json.decode(body)\n  if not data then\n      return false\n  end\n\n  if data['foo'] == 'bar' then\n      return true\n  end\n\n  return false\nend"
           hosts:
           - test.01lb.vip
           paths:
             - /*
           exprs:
             - subject:
                 scope: Header
                 name: User-Agent
               op: RegexMatch
               value: ".*dev.*"
         backends:
           - serviceName: mp-outer-gateway
             servicePort: 8080
   ```


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