zoukankan      html  css  js  c++  java
  • ocelot.json模板

    {
      "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
        }
      }
    }
  • 相关阅读:
    Android高斯模糊技术,实现毛玻璃效果(转)
    设计模式笔记之六:生产消费者模式
    设计模式笔记之五:观察者模式
    设计模式笔记之四:MVP+Retrofit+RxJava组合使用
    设计模式笔记之三:Android DataBinding库(MVVM设计模式)
    Eclipse Code Recommenders 自动补全(联想)神器
    java根据freeMark模板生成内容
    通过java反射机制,获取对象的属性和值(包括所有继承的父类)
    win7下自动更新svn目录
    jdk11 eclipse下开启ZGC
  • 原文地址:https://www.cnblogs.com/yuchenghao/p/12697561.html
Copyright © 2011-2022 走看看