You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "GloryAndDream (via GitHub)" <gi...@apache.org> on 2023/04/07 13:59:18 UTC

[GitHub] [apisix] GloryAndDream commented on issue #9258: help request: Can proxy-rewite plugin support multiple path rewrite?

GloryAndDream commented on issue #9258:
URL: https://github.com/apache/apisix/issues/9258#issuecomment-1500315036

   
   
   
   > Your regex is wrong.
   > 
   > Example:
   > 
   > ```shell
   > curl http://127.0.0.1:9180/apisix/admin/routes/1  \
   > -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   > {
   >     "methods": ["GET"],
   >     "uri": "/*",
   >     "plugins": {
   >         "proxy-rewrite": {
   >             "regex_uri": ["^/(machine|pay)(/.*)", "/$2"]
   >         }
   >     },
   >     "upstream": {
   >         "type": "roundrobin",
   >         "nodes": {
   >             "httpbin.org": 1
   >         }
   >     }
   > }'
   > ```
   
   I tried you regexp, still not working
   
   
   **http://api-test.xxx.com/machine/health**
   
   ```
   
   Whitelabel Error Page
   This application has no explicit mapping for /error, so you are seeing this as a fallback.
   
   Fri Apr 07 21:56:08 CST 2023
   There was an unexpected error (type=Not Found, status=404).
   ```
   
   
   **http://api-test.xxx.com/machine**
   
   `{"error_msg":"404 Route Not Found"}`
   
   seems only first part of path goes to controller, by the way, the API is built on springboot


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