diff --git a/doc/admin-api.md b/doc/admin-api.md index fa81646c..9c40948b 100644 --- a/doc/admin-api.md +++ b/doc/admin-api.md @@ -17,8 +17,8 @@ # --> +# Table of Contents -Table of contents === * [Route](#route) @@ -167,7 +167,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 }' ``` -[Back to TOC](#table-of-contents) +[Back to TOC](#Table-of-Contents) ## Service @@ -245,7 +245,7 @@ Server: APISIX web server Return response from etcd currently. -[Back to TOC](#table-of-contents) +[Back to TOC](#Table-of-Contents) ## Consumer @@ -312,7 +312,7 @@ Date: Thu, 26 Dec 2019 08:17:49 GMT Return response from etcd currently. -[Back to TOC](#table-of-contents) +[Back to TOC](#Table-of-Contents) ## Upstream @@ -392,7 +392,7 @@ Content-Type: text/plain Return response from etcd currently. -[Back to TOC](#table-of-contents) +[Back to TOC](#Table-of-Contents) ## SSL @@ -428,4 +428,4 @@ Config Example: } ``` -[Back to TOC](#table-of-contents) +[Back to TOC](#Table-of-Contents) diff --git a/doc/architecture-design-cn.md b/doc/architecture-design-cn.md index 27b4ccaa..251a0f37 100644 --- a/doc/architecture-design-cn.md +++ b/doc/architecture-design-cn.md @@ -17,7 +17,8 @@ # --> -## 目录 +# 目录 + - [**APISIX**](#apisix) - [**APISIX Config**](#apisix-config) - [**Route**](#route) @@ -33,7 +34,7 @@ ### 插件加载流程 -![](./images/flow-load-plugin.png) +![插件加载流程](./images/flow-load-plugin.png) ### 插件内部结构 @@ -230,7 +231,7 @@ Upstream 是虚拟主机抽象,对给定的多个服务节点按照配置规 Upstream 的配置可以被直接绑定在指定 `Route` 中,也可以被绑定在 `Service` 中,不过 `Route` 中的配置 优先级更高。这里的优先级行为与 `Plugin` 非常相似 -#### 配置参数 +### 配置参数 APISIX 的 Upstream 除了基本的复杂均衡算法选择外,还支持对上游做主被动健康检查、重试等逻辑,具体看下面表格。 @@ -245,6 +246,7 @@ APISIX 的 Upstream 除了基本的复杂均衡算法选择外,还支持对上 |enable_websocket|可选| 是否启用 `websocket`(布尔值),默认不启用| `hash_on` 比较复杂,这里专门说明下: + 1. 设为 `vars` 时,`key` 为必传参数,目前支持的 Nginx 内置变量有 `uri, server_name, server_addr, request_uri, remote_port, remote_addr, query_string, host, hostname, arg_***`,其中 `arg_***` 是来自URL的请求参数,[Nginx 变量列表](http://nginx.org/en/docs/varindex.html) 1. 设为 `header` 时, `key` 为必传参数,其值为自定义的 header name, 即 "http_`key`" 1. 设为 `cookie` 时, `key` 为必传参数,其值为自定义的 cookie name,即 "cookie_`key`" @@ -310,6 +312,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 ``` 下面是一个配置了健康检查的示例: + ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { @@ -345,11 +348,15 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 } }' ``` + 更多细节可以参考[健康检查的文档](health-check.md)。 下面是几个使用不同`hash_on`类型的配置示例: -##### Consumer + +#### Consumer + 创建一个consumer对象: + ```shell curl http://127.0.0.1:9080/apisix/admin/consumers -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ` { @@ -361,7 +368,9 @@ curl http://127.0.0.1:9080/apisix/admin/consumers -H 'X-API-KEY: edd1c9f034335f1 } }` ``` + 新建路由,打开`key-auth`插件认证,`upstream`的`hash_on`类型为`consumer`: + ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { @@ -379,13 +388,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 "uri": "/server_port" }' ``` + 测试请求,认证通过后的`consumer_id`将作为负载均衡哈希算法的哈希值: + ```shell curl http://127.0.0.1:9080/server_port -H "apikey: auth-jack" ``` ##### Cookie + 新建路由和`Upstream`,`hash_on`类型为`cookie`: + ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { @@ -403,12 +416,15 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 ``` 客户端请求携带`Cookie`: + ```shell curl http://127.0.0.1:9080/hash_on_cookie -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -H "Cookie: sid=3c183a30cffcda1408daf1c61d47b274" ``` ##### Header + 新建路由和`Upstream`,`hash_on`类型为`header`, `key`为`content-type`: + ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { @@ -426,13 +442,13 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 ``` 客户端请求携带`content-type`的`header`: + ```shell curl http://127.0.0.1:9080/hash_on_header -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -H "Content-Type: application/json" ``` [返回目录](#目录) - ## Router APISIX 区别于其他 API 网关的一大特点是允许用户选择不同 Router 来更好匹配自由业务,在性能、自由之间做最适合选择。 @@ -531,8 +547,10 @@ HTTP/1.1 503 Service Temporarily Unavailable [返回目录](#目录) ## Global Rule + [Plugin](#Plugin) 只能绑定在 [Service](#Service) 或者 [Route](#Route) 上,如果我们需要一个能作用于所有请求的 [Plugin](#Plugin) 该怎么办呢? 这时候我们可以使用 `GlobalRule` 来注册一个全局的 [Plugin](#Plugin): + ```shell curl -X PUT \ https://{apisix_listen_address}/apisix/admin/global_rules/1 \ @@ -549,9 +567,11 @@ curl -X PUT \ } }' ``` + 如上所注册的 `limit-count` 插件将会作用于所有的请求。 我们可以通过以下接口查看所有的 `GlobalRule`: + ```shell curl https://{apisix_listen_address}/apisix/admin/global_rules ``` diff --git a/doc/architecture-design.md b/doc/architecture-design.md index 9731a789..e580ab37 100644 --- a/doc/architecture-design.md +++ b/doc/architecture-design.md @@ -20,6 +20,7 @@ [Chinese](architecture-design-cn.md) ## Table of Contents + - [**APISIX**](#apisix) - [**APISIX Config**](#apisix-config) - [**Route**](#route) @@ -35,7 +36,7 @@ ### Plugin Loading Process -![](./images/flow-load-plugin.png) +![flow-load-plugin](./images/flow-load-plugin.png) ### Plugin Hierarchy Structure @@ -225,7 +226,7 @@ As shown in the image above, by creating an Upstream object and referencing it b Upstream configuration can be directly bound to the specified `Route` or it can be bound to `Service`, but the configuration in `Route` has a higher priority. The priority behavior here is very similar to `Plugin`. -#### Configuration +### Configuration In addition to the basic complex equalization algorithm selection, APISIX's Upstream also supports logic for upstream passive health check and retry, see the table below. @@ -340,8 +341,11 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 More details can be found in [Health Checking Documents](health-check.md). Here are some examples of configurations using different `hash_on` types: -##### Consumer + +#### Consumer + Create a consumer object: + ```shell curl http://127.0.0.1:9080/apisix/admin/consumers -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ` { @@ -353,7 +357,9 @@ curl http://127.0.0.1:9080/apisix/admin/consumers -H 'X-API-KEY: edd1c9f034335f1 } }` ``` + Create route object and enable `key-auth` plugin authentication: + ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { @@ -371,13 +377,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 "uri": "/server_port" }' ``` + Test request, the `consumer_id` after authentication is passed will be used as the hash value of the load balancing hash algorithm: + ```shell curl http://127.0.0.1:9080/server_port -H "apikey: auth-jack" ``` -##### Cookie +#### Cookie + Create route and upstream object, `hash_on` is `cookie`: + ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { @@ -393,13 +403,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 } }' ``` + The client requests with `Cookie`: + ```shell curl http://127.0.0.1:9080/hash_on_cookie -H "Cookie: sid=3c183a30cffcda1408daf1c61d47b274" ``` -##### Header +#### Header + Create route and upstream object, `hash_on` is `header`, `key` is `Content-Type`: + ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { @@ -417,13 +431,13 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 ``` The client requests with header `Content-Type`: + ```shell curl http://127.0.0.1:9080/hash_on_header -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -H "Content-Type: application/json" ``` [Back to top](#Table-of-contents) - ## Router A distinguishing feature of APISIX from other API gateways is that it allows users to choose different routers to better match free services, making the best choice between performance and freedom. @@ -522,8 +536,10 @@ HTTP/1.1 503 Service Temporarily Unavailable [Back to top](#Table-of-contents) ## Global Rule + [Plugin](#Plugin) just can be binded to [Service](#Service) or [Route](#Route), if we want a [Plugin](#Plugin) work on all requests, how to do it? We can register a global [Plugin](#Plugin) with `GlobalRule`: + ```shell curl -X PUT \ https://{apisix_listen_address}/apisix/admin/global_rules/1 \ @@ -540,9 +556,11 @@ curl -X PUT \ } }' ``` + Now, the `limit-count` plugin will work on all requets we can list all `GlobalRule` via admin api as below: + ```shell curl https://{apisix_listen_address}/apisix/admin/global_rules ``` diff --git a/doc/grpc-proxy.md b/doc/grpc-proxy.md index a6b8cf01..22e32973 100644 --- a/doc/grpc-proxy.md +++ b/doc/grpc-proxy.md @@ -18,18 +18,17 @@ --> [中文](grpc-proxy-cn.md) + # grpc-proxy proxying gRPC traffic: gRPC client -> APISIX -> gRPC server -### Parameters +## Parameters * `service_protocol`: the route's option `service_protocol` must be `grpc` * `uri`: format likes /service/method , Example:/helloworld.Greeter/SayHello - - ### Example #### create proxying gRPC route @@ -55,7 +54,6 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f13 }' ``` - #### testing Invoking the route created before: @@ -68,4 +66,3 @@ $ grpcurl -insecure -import-path /pathtoprotos -proto helloworld.proto -d '{"n ``` This means that the proxying is working. - diff --git a/doc/health-check.md b/doc/health-check.md index 5bcf58c3..b0b062de 100644 --- a/doc/health-check.md +++ b/doc/health-check.md @@ -16,8 +16,6 @@ # limitations under the License. # --> - - ## Health Checks for Upstream Health Check of APISIX is based on [lua-resty-healthcheck](https://github.com/Kong/lua-resty-healthcheck), diff --git a/doc/https-cn.md b/doc/https-cn.md index cf9a8ce7..4ea82d5f 100644 --- a/doc/https-cn.md +++ b/doc/https-cn.md @@ -18,6 +18,7 @@ --> [English](https.md) + ### HTTPS `APISIX` 支持通过 TLS 扩展 SNI 实现加载特定的 SSL 证书以实现对 https 的支持。 diff --git a/doc/https.md b/doc/https.md index 04f2ea5f..5e7aa0ed 100644 --- a/doc/https.md +++ b/doc/https.md @@ -18,6 +18,7 @@ --> [Chinese](https-cn.md) + ### HTTPS `APISIX` supports to load a specific SSL certificate by TLS extension Server Name Indication (SNI). @@ -67,7 +68,6 @@ that means it can accept more than one domain, eg: `www.test.com` or `mail.test. Here is an example, please pay attention on the field `sni`. - ```shell curl http://127.0.0.1:9080/apisix/admin/ssl/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { diff --git a/doc/plugin-develop-cn.md b/doc/plugin-develop-cn.md index 9da4f6cd..c8a7663b 100644 --- a/doc/plugin-develop-cn.md +++ b/doc/plugin-develop-cn.md @@ -19,6 +19,7 @@ [English](plugin-develop.md) # 目录 + - [**检查外部依赖**](#检查外部依赖) - [**插件命名与配置**](#插件命名与配置) - [**配置描述与校验**](#配置描述与校验) @@ -26,7 +27,6 @@ - [**编写执行逻辑**](#编写执行逻辑) - [**编写测试用例**](#编写测试用例) - ## 检查外部依赖 如果你的插件,涉及到一些外部的依赖和三方库,请首先检查一下依赖项的内容。 如果插件需要用到共享内存,需要在 __bin/apisix__ 文 @@ -167,6 +167,7 @@ done ``` 一个测试用例主要有三部分内容: + - 程序代码: Nginx location 的配置内容 - 输入: http 的 request 信息 - 输出检查: status ,header ,body ,error_log 检查 @@ -175,9 +176,8 @@ done 用例的断言是 response_body 返回 "done",__no_error_log__ 表示会对 Nginx 的 error.log 检查, 必须没有 ERROR 级别的记录。 -### 附上test-nginx 执行流程: +### 附上test-nginx 执行流程 根据我们在 Makefile 里配置的 PATH,和每一个 __.t__ 文件最前面的一些配置项,框架会组装成一个完整的 nginx.conf 文件, __t/servroot__ 会被当成 Nginx 的工作目录,启动 Nginx 实例。根据测试用例提供的信息,发起 http 请求并检查 http 的返回项, 包括 http status,http response header, http response body 等。 - diff --git a/doc/plugin-develop.md b/doc/plugin-develop.md index 8e18b0dc..f6a6cb66 100644 --- a/doc/plugin-develop.md +++ b/doc/plugin-develop.md @@ -19,6 +19,7 @@ [中文](plugin-develop-cn.md) # table of contents + - [**check dependencies**](#check-dependencies) - [**name and config**](#name-and-config) - [**schema and check**](#schema-and-check) @@ -26,7 +27,6 @@ - [**implement the logic**](#implement-the-logic) - [**write test case**](#write-test-case) - ## check dependencies if you have dependencies on external libraries, check the dependent items. if your plugin needs to use shared memory, it @@ -183,6 +183,7 @@ done ``` A test case consists of three parts : + - __Program code__ : configuration content of Nginx location - __Input__ : http request information - __Output check__ : status, header, body, error log check diff --git a/doc/plugins-cn.md b/doc/plugins-cn.md index 02632b27..103cfb07 100644 --- a/doc/plugins-cn.md +++ b/doc/plugins-cn.md @@ -24,6 +24,7 @@ APISIX 的插件是热加载的,不管你是新增、删除还是修改插件,都不需要重启服务。 只需要通过 admin API 发送一个 HTTP 请求即可: + ```shell curl http://127.0.0.1:9080/apisix/admin/plugins/reload -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT ``` diff --git a/doc/plugins.md b/doc/plugins.md index 5f938c35..081d2d73 100644 --- a/doc/plugins.md +++ b/doc/plugins.md @@ -20,9 +20,11 @@ [Chinese](plugins-cn.md) ## Hot reload + APISIX plug-ins are hot-loaded. No matter you add, delete or modify plug-ins, you don't need to restart the service. Just send an HTTP request through admin API: + ```shell curl http://127.0.0.1:9080/apisix/admin/plugins/reload -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT ``` diff --git a/doc/plugins/limit-count-cn.md b/doc/plugins/limit-count-cn.md index bee8ef4c..1768ebc6 100644 --- a/doc/plugins/limit-count-cn.md +++ b/doc/plugins/limit-count-cn.md @@ -18,12 +18,13 @@ --> [English](limit-count.md) + # limit-count 和 [GitHub API 的限速](https://developer.github.com/v3/#rate-limiting)类似, 在指定的时间范围内,限制总的请求个数。并且在 HTTP 响应头中返回剩余可以请求的个数。 -### 参数 +## 参数 |名称 |可选项 |说明| |--------- |--------|-----------| @@ -40,6 +41,7 @@ ### 示例 #### 开启插件 + 下面是一个示例,在指定的 `route` 上开启了 `limit count` 插件: ```shell @@ -64,10 +66,10 @@ curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335 ``` 你可以使用浏览器打开 dashboard:`http://127.0.0.1:9080/apisix/dashboard/`,通过 web 界面来完成上面的操作,先增加一个 route: -![](../images/plugin/limit-count-1.png) +![添加路由](../images/plugin/limit-count-1.png) 然后在 route 页面中添加 limit-count 插件: -![](../images/plugin/limit-count-2.png) +![添加插件](../images/plugin/limit-count-2.png) 如果你需要一个集群级别的流量控制,我们可以借助 redis server 来完成。不同的 APISIX 节点之间将共享流量限速结果,实现集群流量限速。 @@ -100,12 +102,15 @@ curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335 ``` #### 测试插件 + 上述配置限制了 60 秒内只能访问 2 次,前两次访问都会正常访问: + ```shell curl -i http://127.0.0.1:9080/index.html ``` 响应头里面包含了 `X-RateLimit-Limit` 和 `X-RateLimit-Remaining`,他们的含义分别是限制的总请求数和剩余还可以发送的请求数: + ``` HTTP/1.1 200 OK Content-Type: text/html @@ -117,6 +122,7 @@ Server: APISIX web server ``` 当你第三次访问的时候,就会收到包含 503 返回码的响应头: + ``` HTTP/1.1 503 Service Temporarily Unavailable Content-Type: text/html @@ -136,6 +142,7 @@ Server: APISIX web server 这就表示 `limit count` 插件生效了。 #### 移除插件 + 当你想去掉 `limit count` 插件的时候,很简单,在插件的配置中把对应的 json 配置删除即可,无须重启服务,即刻生效: ```shell diff --git a/doc/plugins/limit-count.md b/doc/plugins/limit-count.md index 122f0dc9..44eca68e 100644 --- a/doc/plugins/limit-count.md +++ b/doc/plugins/limit-count.md @@ -20,6 +20,7 @@ [Chinese](limit-count-cn.md) # Summary + - [**Name**](#name) - [**Attributes**](#attributes) - [**How To Enable**](#how-to-enable) @@ -70,10 +71,10 @@ curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335 ``` You can open dashboard with a browser: `http://127.0.0.1:9080/apisix/dashboard/`, to complete the above operation through the web interface, first add a route: -![](../images/plugin/limit-count-1.png) +![Add a router.](../images/plugin/limit-count-1.png) Then add limit-count plugin: -![](../images/plugin/limit-count-2.png) +![Add limit-count plugin.](../images/plugin/limit-count-2.png) If you need a cluster-level precision traffic limit, then we can do it with the redis server. The rate limit of the traffic will be shared between different APISIX nodes to limit the rate of cluster traffic. @@ -106,13 +107,16 @@ curl -i http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335 ``` ## Test Plugin + The above configuration limits access to only 2 times in 60 seconds. The first two visits will be normally: + ```shell curl -i http://127.0.0.1:9080/index.html ``` The response header contains `X-RateLimit-Limit` and `X-RateLimit-Remaining`, which mean the total number of requests and the remaining number of requests that can be sent: + ``` HTTP/1.1 200 OK Content-Type: text/html @@ -124,6 +128,7 @@ Server: APISIX web server ``` When you visit for the third time, you will receive a response with the 503 HTTP code: + ``` HTTP/1.1 503 Service Temporarily Unavailable Content-Type: text/html @@ -143,9 +148,11 @@ Server: APISIX web server This means that the `limit count` plugin is in effect. ## Disable Plugin + When you want to disable the `limit count` plugin, it is very simple, you can delete the corresponding json configuration in the plugin configuration, no need to restart the service, it will take effect immediately: + ```shell curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { diff --git a/doc/profile-cn.md b/doc/profile-cn.md index df9a214c..5f219dcf 100644 --- a/doc/profile-cn.md +++ b/doc/profile-cn.md @@ -23,10 +23,8 @@ 如果把所有环境的配置都放在同一个文件里,非常不好管理,我们接到新需求后,在开发环境进行开发时,需要将配置文件中的参数都改成开发环境的,提交代码时还要改回去,这样改来改去非常容易出错。 - 上述问题的解决办法就是通过环境变量来区分当前运行环境,并通过环境变量来切换不同配置文件。APISIX 中对应的环境变量就是:`APISIX_PROFILE`。 - 在没有设置`APISIX_PROFILE` 时,默认使用以下三个配置文件: * conf/config.yaml diff --git a/doc/profile.md b/doc/profile.md index 398e77c0..214bc9d2 100644 --- a/doc/profile.md +++ b/doc/profile.md @@ -30,14 +30,13 @@ development environment. You have to change it back. It's very easy to make mist The solution to the above problem is to distinguish the current running environment through environment variables, and switch between different configuration files through environment variables. The corresponding environment variable in APISIX is: `APISIX_PROFILE` - When `APISIX_PROFILE` is not set, the following three configuration files are used by default: * conf/config.yaml * conf/apisix.yaml * conf/debug.yaml -If the value of `APISIX_PROFILE` is set to` prod`, the following three configuration files are used: +If the value of `APISIX_PROFILE` is set to `prod`, the following three configuration files are used: * conf/config-prod.yaml * conf/apisix-prod.yaml diff --git a/doc/router-radixtree.md b/doc/router-radixtree.md index de47cdaa..ef825c67 100644 --- a/doc/router-radixtree.md +++ b/doc/router-radixtree.md @@ -68,7 +68,6 @@ Here are the rules: |/blog/foo/gloo | `/blog/foo/*` | |/blog/bar | not match | - ### How to filter route by Nginx builtin variable Please take a look at [radixtree-new](https://github.com/iresty/lua-resty-radixtree#new), diff --git a/doc/stream-proxy-cn.md b/doc/stream-proxy-cn.md index 92416b25..0a413d73 100644 --- a/doc/stream-proxy-cn.md +++ b/doc/stream-proxy-cn.md @@ -30,7 +30,7 @@ APISIX 可以对 TCP/UDP 协议进行代理并实现动态负载均衡。 在 ng 在 `conf/config.yaml` 配置文件设置 `stream_proxy` 选项, 指定一组需要进行动态代理的IP地址。默认情况不开启stream代理。 -``` +```yaml apisix: stream_proxy: # TCP/UDP proxy tcp: # TCP proxy address list @@ -78,4 +78,5 @@ curl http://127.0.0.1:9080/apisix/admin/stream_routes/1 -H 'X-API-KEY: edd1c9f03 } }' ``` + 例子中 APISIX 把上游地址 `127.0.0.1:1995` 代理成地址为 `127.0.0.1`, 端口为 `2000` diff --git a/doc/stream-proxy.md b/doc/stream-proxy.md index e149ce48..7956be74 100644 --- a/doc/stream-proxy.md +++ b/doc/stream-proxy.md @@ -30,7 +30,7 @@ APISIX can dynamic load balancing TCP/UDP proxy. In Nginx world, we call TCP/UDP Setting the `stream_proxy` option in `conf/config.yaml`, specify a list of addresses that require dynamic proxy. By default, no any stream proxy is enabled. -``` +```yaml apisix: stream_proxy: # TCP/UDP proxy tcp: # TCP proxy address list