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: [email protected]
