Description
Hello I am new user for apisix.
I want to use jwt-auth and proxy-rewrite plugins for my service.
Suppose it is an user service and it supports several apis like /register, /login, /rename and so on.
Routes like /register and login will not use jwt-auth plugin but others need. So I add a script like this:
#!/bin/bash
curl http://127.0.0.1:9080/apisix/admin/routes/route1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"methods": ["GET", "POST", "PUT", "DELETE"],
"uris": [
"/api/rename*",
"/api/list*",
"/api/etc*"
],
"plugins": {
"jwt-auth": {},
"proxy-rewrite": {
"/regex_uri": ["/api/", "/svc/"]
}
},
"upstream" : {
"type": "roundrobin",
"nodes": {
"node1:12345": 1,
"node2:12345": 1
}
}
}'
curl http://127.0.0.1:9080/apisix/admin/routes/route2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"methods": ["GET", "POST", "PUT", "DELETE"],
"uris": [
"/api/register*",
"/api/login*"
],
"plugins": {
"proxy-rewrite": {
"/regex_uri": ["/api/", "/svc/"]
}
},
"upstream" : {
"type": "roundrobin",
"nodes": {
"node1:12345": 1,
"node2:12345": 1
}
}
}'
The difference between route1 and route2 is only whether using jwt-auth plugin.
I want to make my start-up script more concise and decrease apisix routes setting, so is there a better way to filter plugins' usage by specific condition? (such as url regular expression)
Thanks in advance.
Environment
- APISIX version (run
apisix version): 2.13.0
- Operating system (run
uname -a): Linux 0c06ebd3850b 5.10.76-linuxkit # 1 SMP Mon Nov 8 10:21:19 UTC 2021 x86_64 Linux
- OpenResty / Nginx version (run
openresty -V or nginx -V): openresty/1.19.3.2
- etcd version, if relevant (run
curl http://127.0.0.1:9090/v1/server_info):
- APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run
luarocks --version):
Description
Hello I am new user for apisix.
I want to use
jwt-authandproxy-rewriteplugins for my service.Suppose it is an user service and it supports several apis like
/register,/login,/renameand so on.Routes like
/registerandloginwill not usejwt-authplugin but others need. So I add a script like this:The difference between
route1androute2is only whether usingjwt-authplugin.I want to make my start-up script more concise and decrease apisix routes setting, so is there a better way to filter plugins' usage by specific condition? (such as url regular expression)
Thanks in advance.
Environment
apisix version): 2.13.0uname -a): Linux 0c06ebd3850b 5.10.76-linuxkit # 1 SMP Mon Nov 8 10:21:19 UTC 2021 x86_64 Linuxopenresty -Vornginx -V): openresty/1.19.3.2curl http://127.0.0.1:9090/v1/server_info):luarocks --version):