You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/05/07 07:15:38 UTC

[GitHub] [apisix] juzhiyuan commented on a change in pull request #4152: feat: redirect plugin support regex

juzhiyuan commented on a change in pull request #4152:
URL: https://github.com/apache/apisix/pull/4152#discussion_r627981772



##########
File path: docs/zh/latest/plugins/redirect.md
##########
@@ -29,6 +29,7 @@ URI 重定向插件。
 | ------------- | ------- | ----------- | ------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
 | http_to_https | boolean | 可选        | false   |            | 当设置为 `true` 并且请求是 http 时,会自动 301 重定向为 https,uri 保持不变                                                                                                                                                   |
 | uri           | string  | 可选        |         |            | 可以包含 Nginx 变量的 URI,例如:`/test/index.html`, `$uri/index.html`。你可以通过类似于 `$ {xxx}` 的方式引用变量,以避免产生歧义,例如:`${uri}foo/index.html`。若你需要保留 `$` 字符,那么使用如下格式:`/\$foo/index.html` |
+| regex_uri | array[string] | 可选        |         |                   | 转发到上游的新 `uri` 地址, 使用正则表达式匹配来自客户端的uri,当匹配成功后使用模板替换发送重定向到客户端, 未匹配成功时将客户端请求的uri转发至上游。`uri`和`regex_uri`不可以同时存在。例如:["^/iresty/(.*)/(.*)/(.*)","/$1-$2-$3"] 第一个元素代表匹配来自客户端请求的uri正则表达式,第二个元素代表匹配成功后发送重定向到客户端的uri模板。 |

Review comment:
       ```suggestion
   | regex_uri | array[string] | 可选        |         |                   | 转发到上游的新 `uri` 地址, 使用正则表达式匹配来自客户端的 `uri`,当匹配成功后使用模板替换发送重定向到客户端, 未匹配成功时将客户端请求的 `uri` 转发至上游。`uri` 和 `regex_uri` 不可以同时存在。例如:["^/iresty/(.*)/(.*)/(.*)","/$1-$2-$3"] 第一个元素代表匹配来自客户端请求的 `uri` 正则表达式,第二个元素代表匹配成功后发送重定向到客户端的 `uri` 模板。 |
   ```




-- 
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:
users@infra.apache.org