{ "ReRoutes": [ { "DownstreamPathTemplate": "/DemoService/{url}", // 下游游请求模板 "UpstreamPathTemplate": "/{url}", // 上游请求模板 "UpstreamHttpMethod": [ "Get", "Post", "Delete", "Put", "Option" ], // 上游请求http方法 "AddHeadersToRequest": {}, "UpstreamHeaderTransform": {}, "DownstreamHeaderTransform": {}, "AddClaimsToRequest": {}, "RouteClaimsRequirement": {}, "AddQueriesToRequest": {}, "RequestIdKey": null, //缓存配置 "FileCacheOptions": { "TtlSeconds": 10, //缓存时间(秒)。 "Region": "somename" //缓存分区名 }, "ReRouteIsCaseSensitive": false, "ServiceName": "DemoService", "DownstreamScheme": "http", //下游服务 schema //配置服务认证 "AuthenticationOptions": { "AuthenticationProviderKey": "", "AllowedScopes": [] }, "HttpHandlerOptions": { "AllowAutoRedirect": false, "UseCookieContainer": false, "UseTracing": false, "UseProxy": true }, "DownstreamHostAndPorts": [], "UpstreamHost": null, "Key": null, "DelegatingHandlers": [], "Priority": 1, "Timeout": 0, "DangerousAcceptAnyServerCertificateValidator": false, "SecurityOptions": { "IPAllowedList": [], "IPBlockedList": [] } } ], "DynamicReRoutes": [], "Aggregates": [], "GlobalConfiguration": { "BaseUrl": null, //网关暴露的的地址 "RequestIdKey": null, "ServiceDiscoveryProvider": { "Host": "192.168.199.203", "Port": 8500, "Type": "Consul", "Token": "", "ConfigurationKey": "OcelotYCH", "PollingInterval": 1000, "Namespace": null }, //限流配置 "RateLimitOptions": { "ClientIdHeader": "ClientId", //用来设别客户请求头,默认为ClientId "QuotaExceededMessage": "Too many requests", //提示信息 "RateLimitCounterPrefix": "ocelot", "DisableRateLimitHeaders": false, //是否显示X-Rate-Limit和Retry-After头 "HttpStatusCode": 429, //状态码 "ClientWhitelist": [], //白名单,不受限流控制 "EnableRateLimiting": true, //启用限流 "Period": "1s", //限流控制的时间段 1s, 5m, 1h, 1d "PeriodTimespan": 1, //超过限流限制的次数后,需要等待重置的时间(单位是秒)。 "Limit": 10 //在限流控制时间段内最大访问数 }, //熔断配置 "QoSOptions": { "ExceptionsAllowedBeforeBreaking": 3, //允许多少个异常请求 "DurationOfBreak": 10, //熔断的时间,单位为秒 "TimeoutValue": 5000 //如果下游请求的处理时间超过多少则将请求设置为超时 }, "LoadBalancerOptions": { "Type": "LeastConnection", "Key": null, "Expiry": 0 }, "DownstreamScheme": null, "HttpHandlerOptions": { "AllowAutoRedirect": false, "UseCookieContainer": false, "UseTracing": false, "UseProxy": true } } }