内容如下(最简单的配置,采用默认路由模板):
1 { 2 "ReRoutes": [ 3 { 4 // - 上游服务配置 5 "UpstreamPathTemplate": "/{url}", 6 "UpstreamHttpMethod": [ "Get", "Post", "Put", "Delete" ], 7 8 // - 下游服务配置 9 "DownstreamPathTemplate": "/{url}", 10 "DownstreamScheme": "http", 11 "DownstreamHostAndPorts": [ 12 { 13 "Host": "localhost", 14 "Port": 39991 15 }, 16 { 17 "Host": "localhost", 18 "Port": 39992 19 }, 20 { 21 "Host": "localhost", 22 "Port": 39993 23 } 24 ], 25 26 // - LoadBalancer将决定负载均衡的算法,三种取值 27 // RoundRobin:轮流发送 28 // LeastConnection:将请求发往最空闲的那个服务器 29 // NoLoadBalance:总是发往第一个请求或者是服务发现 30 "LoadBalancerOptions": { 31 "Type": "RoundRobin" 32 } 33 } 34 ], 35 "GlobalConfiguration": { 36 "BaseUrl": "https://api.mybusiness.com" 37 } 38 }