Skip to content

Commit dd35091

Browse files
authored
docs: update stream proxy doc for proxy_mode and some formatting (#12108)
1 parent 2eb08ea commit dd35091

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

docs/en/latest/stream-proxy.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,10 @@ APISIX can serve as a stream proxy, in addition to being an application layer pr
3030
By default, stream proxy is disabled.
3131

3232
To enable this option, set `apisix.proxy_mode` to `stream` or `http&stream`, depending on whether you want stream proxy only or both http and stream. Then add the `apisix.stream_proxy` option in `conf/config.yaml` and specify the list of addresses where APISIX should act as a stream proxy and listen for incoming requests.
33-
:::note
34-
35-
This "apisix.stream_proxy" option has only been added in versions after 3.2.1.
36-
37-
:::
3833

3934
```yaml
4035
apisix:
36+
proxy_mode: http&stream # enable both http and stream proxies
4137
stream_proxy:
4238
tcp:
4339
- 9100 # listen on 9100 ports of all network interfaces for TCP requests
@@ -115,6 +111,7 @@ Here is an example with MySQL:
115111

116112
```yaml
117113
apisix:
114+
proxy_mode: http&stream # enable both http and stream proxies
118115
stream_proxy: # TCP/UDP proxy
119116
tcp: # TCP proxy address list
120117
- 9100 # by default uses 0.0.0.0
@@ -182,6 +179,7 @@ First of all, we need to enable TLS for the TCP address:
182179

183180
```yaml
184181
apisix:
182+
proxy_mode: http&stream # enable both http and stream proxies
185183
stream_proxy: # TCP/UDP proxy
186184
tcp: # TCP proxy address list
187185
- addr: 9100
@@ -240,6 +238,6 @@ curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -H "X-API-KEY: $admin_ke
240238
}'
241239
```
242240

243-
By setting the `scheme` to "tls", APISIX will do TLS handshake with the upstream.
241+
By setting the `scheme` to `tls`, APISIX will do TLS handshake with the upstream.
244242

245-
When the client is also speaking TLS over TCP, the SNI from the client will pass through to the upstream. Otherwise, a dummy SNI "apisix_backend" will be used.
243+
When the client is also speaking TLS over TCP, the SNI from the client will pass through to the upstream. Otherwise, a dummy SNI `apisix_backend` will be used.

docs/zh/latest/stream-proxy.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ APISIX 可以对 TCP/UDP 协议进行代理并实现动态负载均衡。在 ngi
2727

2828
## 如何开启 Stream 代理
2929

30-
要启用该选项,请将 `apisix.proxy_mode` 设置为 `stream``http&stream`具体取决于您是只需要流代理还是需要 http 和流。然后在 conf/config.yaml 中添加 apisix.stream_proxy 选项并指定 APISIX 应充当流代理并侦听传入请求的地址列表
30+
要启用该选项,请将 `apisix.proxy_mode` 设置为 `stream``http&stream`具体取决于您是只需要 stream 代理还是需要 http 和 stream。然后在 `conf/config.yaml` 中添加 `apisix.stream_proxy` 选项并指定 APISIX 应充当 stream 代理并侦听传入请求的地址列表
3131

3232
```yaml
3333
apisix:
34+
proxy_mode: http&stream # enable both http and stream proxies
3435
stream_proxy: # TCP/UDP proxy
3536
tcp: # TCP proxy address list
3637
- 9100
@@ -102,6 +103,7 @@ curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -H "X-API-KEY: $admin_ke
102103

103104
```yaml
104105
apisix:
106+
proxy_mode: http&stream # enable both http and stream proxies
105107
stream_proxy: # TCP/UDP proxy
106108
tcp: # TCP proxy address list
107109
- 9100 # by default uses 0.0.0.0
@@ -160,14 +162,15 @@ curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -H "X-API-KEY: $admin_ke
160162

161163
完整的匹配选项列表参见 [Admin API 的 Stream Route](./admin-api.md#stream-route)。
162164

163-
## 接收 TLS over TCP 连接
165+
## 接收基于 TCP 的 TLS 连接
164166

165-
APISIX 支持接收 TLS over TCP 连接。
167+
APISIX 支持接收基于 TCP 的 TLS 连接。
166168

167169
首先,我们需要给对应的 TCP 地址启用 TLS:
168170

169171
```yaml
170172
apisix:
173+
proxy_mode: http&stream # enable both http and stream proxies
171174
stream_proxy: # TCP/UDP proxy
172175
tcp: # TCP proxy address list
173176
- addr: 9100
@@ -192,7 +195,7 @@ curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -H "X-API-KEY: $admin_ke
192195
}'
193196
```
194197

195-
当连接为 TLS over TCP 时,我们可以通过 SNI 来匹配路由,比如:
198+
当连接为基于 TCP 的 TLS 时,我们可以通过 SNI 来匹配路由,比如:
196199

197200
```shell
198201
curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -H "X-API-KEY: $admin_key" -X PUT -d '
@@ -209,9 +212,9 @@ curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -H "X-API-KEY: $admin_ke
209212

210213
在这里,握手时发送 SNI `a.test.com` 的连接会被代理到 `127.0.0.1:5991`。
211214

212-
## 代理到 TLS over TCP 上游
215+
## 代理到基于 TCP 的 TLS 上游
213216

214-
APISIX 还支持代理到 TLS over TCP 上游。
217+
APISIX 还支持代理到基于 TCP 的 TLS 上游。
215218

216219
```shell
217220
curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -H "X-API-KEY: $admin_key" -X PUT -d '
@@ -226,6 +229,6 @@ curl http://127.0.0.1:9180/apisix/admin/stream_routes/1 -H "X-API-KEY: $admin_ke
226229
}'
227230
```
228231

229-
通过设置 `scheme` 为 tls,APISIX 将与上游进行 TLS 握手。
232+
通过设置 `scheme` 为 `tls`,APISIX 将与上游进行 TLS 握手。
230233

231-
当客户端也使用 TLS over TCP,客户端发送的 SNI 将传递给上游。否则,将使用一个假的 SNI "apisix_backend"
234+
当客户端也使用基于 TCP 的 TLS 上游时,客户端发送的 SNI 将传递给上游。否则,将使用一个假的 SNI `apisix_backend`

0 commit comments

Comments
 (0)