agile6v commented on a change in pull request #979: feature: support regex_uri 
option in proxy-rewrite plugin
URL: https://github.com/apache/incubator-apisix/pull/979#discussion_r361467513
 
 

 ##########
 File path: doc/plugins/proxy-rewrite.md
 ##########
 @@ -35,6 +35,7 @@ upstream proxy info rewrite plugin.
 |-------         |-----|------|
 |scheme          |optional| Upstream new `schema` forwarding protocol,options 
can be `http` or `https`,default `http`.|
 |uri             |optional| Upstream new `uri` forwarding address.|
+|regex_uri       |optional| Upstream new `uri` forwarding address. Use regular 
expression to match uri from client, when the match is successful, the uri 
template will be forwarded upstream. If the match is not successful, the uri 
from the client will be forwarded to the upstream. When `uri` and` regex_uri` 
are both exist, `uri` is used first. For example: [" ^/iresty/(.*)/(.*)/(.*)", 
"/$1-$2-$3"], the first element represents the matching regular expression and 
the second element represents the uri template that is forwarded to the 
upstream.|
 
 Review comment:
   Similar to this situation in Nginx.
   ```nginx
   server {
        listen 80;
        location / {
            rewrite ^/hello/(.*) /$1 break;
            proxy_pass http://127.0.0.1:8080;
        }
   }
   
   server {
        listen 8080;
        location / {
                return 200, $uri;
        }
   }
   
   $curl http://127.0.0.1/hello/world
   Output: /world
   
   $curl http://127.0.0.1/other/things
   Output: /other/things
   ```

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


With regards,
Apache Git Services

Reply via email to