This is an automated email from the ASF dual-hosted git repository.
dengliming pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shenyu-website.git
The following commit(s) were added to refs/heads/main by this push:
new b18c289b31 [DOC] Optimize redirect plugin document (#877)
b18c289b31 is described below
commit b18c289b31adc67647da43413e743edcdbc1b8bd
Author: Zhang Yuxuan <[email protected]>
AuthorDate: Fri Mar 24 21:15:11 2023 +0800
[DOC] Optimize redirect plugin document (#877)
* optimize Chinese redirect plugin document
* beautify the Chinese redirect document
* add how to disable redirect plugin in Chinese document
* optimize ShenYu Redirect Plugin Document both in Chinese and English
* #678 format the redirect-plugin.md
* #678 fix the redirect-plugin.md
---
docs/plugin-center/http-process/redirect-plugin.md | 84 +++++++++++++++------
.../plugin-center/http-process/redirect-plugin.md | 78 ++++++++++++++-----
static/img/shenyu/plugin/redirect/demo2-en.png | Bin 0 -> 84149 bytes
static/img/shenyu/plugin/redirect/demo2-zh.png | Bin 0 -> 89227 bytes
.../plugin/redirect/disable-redirect-plugin-en.png | Bin 0 -> 87046 bytes
.../plugin/redirect/disable-redirect-plugin-zh.png | Bin 0 -> 93007 bytes
.../img/shenyu/plugin/redirect/redirect-after.png | Bin 0 -> 226710 bytes
.../img/shenyu/plugin/redirect/redirect-before.png | Bin 0 -> 4545 bytes
.../plugin/redirect/redirect-plugin-enable-en.png | Bin 91179 -> 118563 bytes
.../plugin/redirect/redirect-plugin-enable-zh.png | Bin 100815 -> 120039 bytes
.../redirect/redirect-plugin-forward-rule-en.png | Bin 82569 -> 89520 bytes
.../redirect/redirect-plugin-forward-rule-zh.png | Bin 87299 -> 92862 bytes
.../plugin/redirect/redirect-plugin-rule-en.png | Bin 84560 -> 86648 bytes
.../plugin/redirect/redirect-plugin-rule-zh.png | Bin 88457 -> 86665 bytes
.../plugin/redirect/redirect-procedure-en.png | Bin 0 -> 108843 bytes
.../plugin/redirect/redirect-procedure-zh.png | Bin 0 -> 106998 bytes
static/img/shenyu/plugin/redirect/redirect.png | Bin 0 -> 245320 bytes
17 files changed, 123 insertions(+), 39 deletions(-)
diff --git a/docs/plugin-center/http-process/redirect-plugin.md
b/docs/plugin-center/http-process/redirect-plugin.md
index ea4cef775b..b35736ad09 100644
--- a/docs/plugin-center/http-process/redirect-plugin.md
+++ b/docs/plugin-center/http-process/redirect-plugin.md
@@ -4,25 +4,40 @@ keywords: ["redirect"]
description: redirect plugin
---
-## Explanation
+# 1. Overview
-When the Apache ShenYu gateway makes proxy calls to the target service, it
also allows users to use the `redirect` plugin to redirect requests.
+## 1.1 Plugin Name
-## Plugin Setting
+ - Redirect Plugin
-* In `shenyu-admin` --> BasicConfig --> Plugin --> `redirect` , set to enable.
-* If the user don't use, please disable the plugin in the background.
-* Selectors and rules, only matching requests will be forwarded and
redirected, please see: [Selector And Rule
Config](../../user-guide/admin-usage/selector-and-rule) .
+## 1.2 Appropriate Scenario
+ - As the name suggests, the `redirect` plugin is to re-forward and redirect
`uri`.
-<img src="/img/shenyu/plugin/redirect/redirect-plugin-enable-en.png"
width="70%" height="60%" />
+## 1.3 Plugin functionality
+ - When the Apache ShenYu gateway makes proxy calls to the target service, it
also allows users to use the `redirect` plugin to redirect requests.
-## Maven Dependency
+## 1.4 Plugin code
-Add the plugin dependency in the pom.xml file of the shenyu-bootstrap project.
+ Core module ```shenyu-plugin-context-redirect```
+ Core class ```org.apache.shenyu.plugin.redirect.RedirectPlugin```
-```xml
+## 1.5 Added Since Which shenyu version
+
+ before 2.2.0 .
+
+# 2. How to use plugin
+
+## 2.1 Plugin-use procedure chart
+
+ <img
src="../../../static/img/shenyu/plugin/redirect/redirect-procedure-en.png"
width="40%" height="30%" />
+
+## 2.2 Import pom
+
+ - import maven config in shenyu-bootstrap project's `pom.xml` file.
+
+ ```xml
<!-- apache shenyu redirect plugin start-->
<dependency>
<groupId>org.apache.shenyu</groupId>
@@ -30,23 +45,50 @@ Add the plugin dependency in the pom.xml file of the
shenyu-bootstrap project.
<version>${project.version}</version>
</dependency>
<!-- apache shenyu redirect plugin end-->
-```
+ ```
+
+## 2.3 Enable plugin
+
+ - In `shenyu-admin` --> BasicConfig --> Plugin --> `Redirect` set Status
enable.
+
+ <img
src="../../../static/img/shenyu/plugin/redirect/redirect-plugin-enable-en.png"
width="70%" height="60%" />
+
+## 2.4 Config plugin
+
+ - Selector and rule config, please refer: [Selector and rule
config](../../user-guide/admin-usage/selector-and-rule).
+ - In `shenyu-admin` --> `PluginList` --> `HttpProcess` --> `Redirect`, add
selector config first,then add rule config:
+ - Add selector config
+
+ <img
src="../../../static/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-en.png"
width="80%" height="60%" />
+ - Add rule config
+
+ <img
src="../../../static/img/shenyu/plugin/redirect/redirect-plugin-rule-en.png"
width="80%" height="60%" />
+
+## 2.5 Examples
-## Situation
+### 2.5.1 Redirect
-> As the name suggests, the `redirect` plugin is to re-forward and redirect
`uri`.
+ - When we configure a custom path in `Rule`, it should be a reachable
service path.
+ - When the request is matched, the `ShenYu Gateway` will perform the `308`
service jump according to the customized path.
+ 1. Refer [Local
Deployment](https://shenyu.apache.org/docs/deployment/deployment-local/) to
start admin and bootstrap.
+ 2. Refer 2.2 to import pom and restart bootstrap.
+ 3. Refer 2.3 to enable plugin.
+ 4. Refer 2.4 and [Selector and rule
config](../../user-guide/admin-usage/selector-and-rule).
+ 5. Invoke interface: [demo](http://localhost:9195/http)
+ - Invoke the interface declared by selectors and rules will redirect to the
specified path.
+ - In this demo, it will jump to [ShenYu official
website](https://shenyu.apache.org)
-### Redirect
+ <img src="../../../static/img/shenyu/plugin/redirect/redirect.png"
width="70%" height="60%" />
-* When we configure a custom path in `Rule`, it should be a reachable service
path.
-* When the request is matched, the `ShenYu Gateway` will perform the `308`
service jump according to the customized path.
+### 2.5.2 Gateway's own interface forwarding
-<img src="/img/shenyu/plugin/redirect/redirect-plugin-rule-en.png" width="70%"
height="60%" />
+ - When the matching rules are met, the service will use the
`DispatcherHandler` internal interface for forwarding.
+ - To implement the gateway's own interface forwarding, we need to use `/` as
the prefix in the configuration path. The specific configuration is as shown in
the figure below.
+ <img src="../../../static/img/shenyu/plugin/redirect/demo2-en.png"
width="70%" height="60%" />
-### Gateway's own interface forwarding
+# 3. How to disable plugin
-* When the matching rules are met, the service will use the
`DispatcherHandler` internal interface for forwarding.
-* To implement the gateway's own interface forwarding, we need to use `/` as
the prefix in the configuration path. The specific configuration is as shown in
the figure below.
+- In `shenyu-admin` --> BasicConfig --> Plugin --> `Redirect` set Status
disable.
-<img src="/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-en.png"
width="70%" height="60%" />
+ <img
src="../../../static/img/shenyu/plugin/redirect/disable-redirect-plugin-zh.png"
width="70%" height="60%" />
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/version-2.5.1/plugin-center/http-process/redirect-plugin.md
b/i18n/zh/docusaurus-plugin-content-docs/version-2.5.1/plugin-center/http-process/redirect-plugin.md
index 9a853563fa..760a1a2c5c 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/version-2.5.1/plugin-center/http-process/redirect-plugin.md
+++
b/i18n/zh/docusaurus-plugin-content-docs/version-2.5.1/plugin-center/http-process/redirect-plugin.md
@@ -4,22 +4,38 @@ keywords: ["redirect"]
description: redirect插件
---
-## 说明
+# 1. 概述
-- Apache ShenYu 网关在对目标服务进行代理调用的时候,允许用户使用 `redirect` 插件来重定向请求。
+## 1.1 插件名称
-## 插件设置
+- Redirect(重定向)插件
-- 在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `redirect`,设置为开启。
-- 如果用户不需要,可以把插件禁用。
+## 1.2 适用场景
+- 顾名思义,`Redirect` 插件就是对 `uri` 的重新转发和重定向。
-<img src="/img/shenyu/plugin/redirect/redirect-plugin-enable-zh.png"
width="70%" height="60%" />
+## 1.3 插件功能
+- Apache ShenYu 网关在对目标服务进行代理调用的时候,允许用户使用 `Redirect` 插件来重定向请求。
-## 插件使用
+## 1.4 插件代码
-- 在网关的 `pom.xml` 文件中添加 `redirect` 的支持。
+- 核心模块 ```shenyu-plugin-context-redirect```
+- 核心类 ```org.apache.shenyu.plugin.redirect.RedirectPlugin```
+
+## 1.5 添加自哪个 shenyu 版本
+
+- 2.2.0 版本以前。
+
+# 2. 如何使用插件
+
+## 2.1 插件使用流程图
+
+<img
src="../../../../../../static/img/shenyu/plugin/redirect/redirect-procedure-zh.png"
width="40%" height="30%" />
+
+## 2.2 导入 pom
+
+- 在网关的 `pom.xml` 文件中添加插件 maven 配置。
```xml
<!-- apache shenyu redirect plugin start-->
@@ -31,23 +47,49 @@ description: redirect插件
<!-- apache shenyu redirect plugin end-->
```
+## 2.3 启用插件
+
+- 在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `redirect` 设置为开启。
+
+ <img
src="../../../../../../static/img/shenyu/plugin/redirect/redirect-plugin-enable-zh.png"
width="70%" height="60%" />
+
+## 2.4 配置插件
+
-
选择器和规则,只有匹配的请求,才会进行转发和重定向,请参考:[选择器规则管理](../../user-guide/admin-usage/selector-and-rule)。
+- `shenyu-admin`插件列表 --> `HttpProcess` --> `Redirect`,先添加选择器,然后添加规则:
+- 添加选择器:
+
+ <img
src="../../../../../../static/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-zh.png"
width="70%" height="60%" />
+
+- 添加规则:
+
+ <img
src="../../../../../../static/img/shenyu/plugin/redirect/redirect-plugin-rule-zh.png"
width="70%" height="60%" />
-## 场景
+## 2.5 示例
-> 顾名思义,`redirect` 插件就是对 `uri` 的重新转发和重定向。
+### 2.5.1 重定向
-#### 重定向
+- 我们在 `规则` 配置自定义路径时,应该为一个可达的服务路径。
+- 当匹配到请求后,根据自定义的路径,`Apache ShenYu`网关会进行 `308` 服务跳转。
+1. 参考[本地部署](https://shenyu.apache.org/zh/docs/deployment/deployment-local)启动
admin 和网关
+2. 参考2.2导入 pom 并重启网关
+3. 参考2.3启用插件
+4. 参考2.4及[选择器规则管理](../../user-guide/admin-usage/selector-and-rule)配置插件规则
+5. 接口调用:[示例接口调用](http://localhost:9195/http)
+- 调用选择器和规则声明的接口,将会重定向至指定路径。
+- 在本例中,将跳转至 [ShenYu 官网](https://shenyu.apache.org)
-* 我们在 `Rule` 配置自定义路径时,应该为一个可达的服务路径。
-* 当匹配到请求后,根据自定义的路径,`Apache ShenYu`网关会进行 `308` 服务跳转。
+ <img src="../../../../../../static/img/shenyu/plugin/redirect/redirect.png"
width="70%" height="60%" />
-<img src="/img/shenyu/plugin/redirect/redirect-plugin-rule-zh.png" width="70%"
height="60%" />
+### 2.5.2 网关自身接口转发
+- 当满足匹配规则时,服务内部会使用 `DispatcherHandler` 内部接口转发。
+- 要实现网关自身接口转发,我们需要在配置路径使用 `/` 作为前缀开始,具体配置如下图。
-#### 网关自身接口转发
+ <img src="../../../../../../static/img/shenyu/plugin/redirect/demo2-zh.png"
width="70%" height="60%" />
-* 当满足匹配规则时,服务内部会使用 `DispatcherHandler` 内部接口转发。
-* 要实现网关自身接口转发,我们需要在配置路径使用 `/` 作为前缀开始,具体配置如下图。
+# 3. 如何禁用插件
-<img src="/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-zh.png"
width="70%" height="60%" />
+- 在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `Redirect` 设置为禁用。
+
+ <img
src="../../../../../../static/img/shenyu/plugin/redirect/disable-redirect-plugin-zh.png"
width="70%" height="60%" />
diff --git a/static/img/shenyu/plugin/redirect/demo2-en.png
b/static/img/shenyu/plugin/redirect/demo2-en.png
new file mode 100644
index 0000000000..8a1c4002eb
Binary files /dev/null and b/static/img/shenyu/plugin/redirect/demo2-en.png
differ
diff --git a/static/img/shenyu/plugin/redirect/demo2-zh.png
b/static/img/shenyu/plugin/redirect/demo2-zh.png
new file mode 100644
index 0000000000..1e947dfb84
Binary files /dev/null and b/static/img/shenyu/plugin/redirect/demo2-zh.png
differ
diff --git a/static/img/shenyu/plugin/redirect/disable-redirect-plugin-en.png
b/static/img/shenyu/plugin/redirect/disable-redirect-plugin-en.png
new file mode 100644
index 0000000000..f62ff9c306
Binary files /dev/null and
b/static/img/shenyu/plugin/redirect/disable-redirect-plugin-en.png differ
diff --git a/static/img/shenyu/plugin/redirect/disable-redirect-plugin-zh.png
b/static/img/shenyu/plugin/redirect/disable-redirect-plugin-zh.png
new file mode 100644
index 0000000000..5d387bc88b
Binary files /dev/null and
b/static/img/shenyu/plugin/redirect/disable-redirect-plugin-zh.png differ
diff --git a/static/img/shenyu/plugin/redirect/redirect-after.png
b/static/img/shenyu/plugin/redirect/redirect-after.png
new file mode 100644
index 0000000000..35fc3fe145
Binary files /dev/null and
b/static/img/shenyu/plugin/redirect/redirect-after.png differ
diff --git a/static/img/shenyu/plugin/redirect/redirect-before.png
b/static/img/shenyu/plugin/redirect/redirect-before.png
new file mode 100644
index 0000000000..1fd3bdf47a
Binary files /dev/null and
b/static/img/shenyu/plugin/redirect/redirect-before.png differ
diff --git a/static/img/shenyu/plugin/redirect/redirect-plugin-enable-en.png
b/static/img/shenyu/plugin/redirect/redirect-plugin-enable-en.png
index d75500de26..095aeb8164 100755
Binary files a/static/img/shenyu/plugin/redirect/redirect-plugin-enable-en.png
and b/static/img/shenyu/plugin/redirect/redirect-plugin-enable-en.png differ
diff --git a/static/img/shenyu/plugin/redirect/redirect-plugin-enable-zh.png
b/static/img/shenyu/plugin/redirect/redirect-plugin-enable-zh.png
index 9845df6a46..f3c2f4d125 100755
Binary files a/static/img/shenyu/plugin/redirect/redirect-plugin-enable-zh.png
and b/static/img/shenyu/plugin/redirect/redirect-plugin-enable-zh.png differ
diff --git
a/static/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-en.png
b/static/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-en.png
index 05a4d37b38..700bcd2b67 100755
Binary files
a/static/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-en.png and
b/static/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-en.png differ
diff --git
a/static/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-zh.png
b/static/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-zh.png
index 56517501be..e103af19ba 100755
Binary files
a/static/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-zh.png and
b/static/img/shenyu/plugin/redirect/redirect-plugin-forward-rule-zh.png differ
diff --git a/static/img/shenyu/plugin/redirect/redirect-plugin-rule-en.png
b/static/img/shenyu/plugin/redirect/redirect-plugin-rule-en.png
index dbfaae8796..1a4247ccb6 100755
Binary files a/static/img/shenyu/plugin/redirect/redirect-plugin-rule-en.png
and b/static/img/shenyu/plugin/redirect/redirect-plugin-rule-en.png differ
diff --git a/static/img/shenyu/plugin/redirect/redirect-plugin-rule-zh.png
b/static/img/shenyu/plugin/redirect/redirect-plugin-rule-zh.png
index f730eac8e4..5ff8d3878a 100755
Binary files a/static/img/shenyu/plugin/redirect/redirect-plugin-rule-zh.png
and b/static/img/shenyu/plugin/redirect/redirect-plugin-rule-zh.png differ
diff --git a/static/img/shenyu/plugin/redirect/redirect-procedure-en.png
b/static/img/shenyu/plugin/redirect/redirect-procedure-en.png
new file mode 100644
index 0000000000..1bd83c1017
Binary files /dev/null and
b/static/img/shenyu/plugin/redirect/redirect-procedure-en.png differ
diff --git a/static/img/shenyu/plugin/redirect/redirect-procedure-zh.png
b/static/img/shenyu/plugin/redirect/redirect-procedure-zh.png
new file mode 100644
index 0000000000..8eb8ef3a9b
Binary files /dev/null and
b/static/img/shenyu/plugin/redirect/redirect-procedure-zh.png differ
diff --git a/static/img/shenyu/plugin/redirect/redirect.png
b/static/img/shenyu/plugin/redirect/redirect.png
new file mode 100644
index 0000000000..e7bddcccf5
Binary files /dev/null and b/static/img/shenyu/plugin/redirect/redirect.png
differ