apisix
apisix copied to clipboard
how to use vars in routes?
Issue description
1. I add a new route: { "methods": [ "POST" ], "uris": [ "/test" ], "vars": [["arg_age","==","20"] ], "upstream": {
"nodes": {
"10.3.155.39:8080": 1
},
"type": "roundrobin"
}
}
-
curl -i http://127.0.0.1:9080/api/index -X POST -d '{age:"20", arg_age:"20"}'
-
{"error_msg":"404 Route Not Found"}
Environment
- apisix version (cmd:
apisix version):2.0 - OS:centos7.3
The arg_age variable is for the query parameter in the URI (?age=xxx).
http://nginx.org/en/docs/http/ngx_http_core_module.html#variables
To route according to the sent JSON body you should write your filter function: https://github.com/api7/lua-resty-radixtree/#new