sasakiyori opened a new issue, #7144:
URL: https://github.com/apache/apisix/issues/7144

   ### Description
   
   Hello I am new for apisix.
   I want to use `jwt-auth` and `proxy-rewrite` plugins for my service.
   
   Suppose it is a 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 script like this:
   ```shell
   #!/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`):
   


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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to