{ "ReRoutes": [ { # The downstream path we are forwarding the request to, ocelot will not add a trailing slash. # Ocelot replaces any placeholders {etc} with matched values from the incoming request. "DownstreamPathTemplate": "/identityserverexample/{someid}/something", # The scheme you want Ocelot to use when making the downstream request "DownstreamScheme": "https", # The port you want Ocelot to use when making the downstream request, will default to # scheme if nothing set "DownstreamPort": 80, # The host address of the downstream service, should not have a trailing slash or scheme # if there is a trailing slash Ocelot will remove it. "DownstreamHost" "localhost" # The path template we are listening on for this re route, Ocelot will add a trailing # slash to this property. Then when a request is made Ocelot makes sure a trailing # slash is added, so everything matches "UpstreamPathTemplate": "/identityserverexample", # The method we are listening for on this re route "UpstreamHttpMethod": "Get", # Only support identity server at the moment "AuthenticationOptions": { "Provider": "IdentityServer", "ProviderRootUrl": "http://localhost:52888", "ScopeName": "api", "AdditionalScopes": [ "openid", "offline_access" ], # Required if using reference tokens "ScopeSecret": "secret" }, # WARNING - will overwrite any headers already in the request with these values. # Ocelot will look in the user claims for the key in [] then return the value and save # it as a header with the given key before the colon (:). The index selection on value # means that Ocelot will use the delimiter specified after the next > to split the # claim value and return the index specified. "AddHeadersToRequest": { "CustomerId": "Claims[CustomerId] > value", "LocationId": "Claims[LocationId] > value", "UserType": "Claims[sub] > value[0] > |", "UserId": "Claims[sub] > value[1] > |" }, # WARNING - will overwrite any claims already in the request with these values. # Ocelot will look in the user claims for the key in [] then return the value and save # it as a claim with the given key before the colon (:). The index selection on value # means that Ocelot will use the delimiter specified after the next > to split the # claim value and return the index specified. "AddClaimsToRequest": { "CustomerId": "Claims[CustomerId] > value", "LocationId": "Claims[LocationId] > value", "UserType": "Claims[sub] > value[0] > |", "UserId": "Claims[sub] > value[1] > |" }, # WARNING - will overwrite any query string entries already in the request with these values. # Ocelot will look in the user claims for the key in [] then return the value and save # it as a query string with the given key before the colon (:). The index selection on value # means that Ocelot will use the delimiter specified after the next > to split the # claim value and return the index specified. "AddQueriesToRequest": { "CustomerId": "Claims[CustomerId] > value", "LocationId": "Claims[LocationId] > value", "UserType": "Claims[sub] > value[0] > |", "UserId": "Claims[sub] > value[1] > |" }, # This specifies any claims that are required for the user to access this re route. # In this example the user must have the claim type UserType and # the value must be registered "RouteClaimsRequirement": { "UserType": "registered" }, # This tells Ocelot to look for a header and use its value as a request/correlation id. # If it is set here then the id will be forwarded to the downstream service. If it # does not then it will not be forwarded "RequestIdKey": "OcRequestId", # If this is set the response from the downstream service will be cached using the key that called it. # This gives the user a chance to influence the key by adding some random query string paramter for # a user id or something that would get ignored by the downstream service. This is a hack and I # intend to provide a mechanism the user can specify for the ttl caching. Also want to expand # the caching a lot. "FileCacheOptions": { "TtlSeconds": 15 }, # The value of this is used when matching the upstream template to an upstream url. "ReRouteIsCaseSensitive": false, # Tells Ocelot the name of the service it is looking when making requests to service discovery # for hosts and ports "ServiceName": "product" # Tells Ocelot which load balancer to use when making downstream requests. "LoadBalancer": "RoundRobin" }, # This section is meant to be for global configuration settings "GlobalConfiguration": { # If this is set it will override any route specific request id keys, behaves the same # otherwise "RequestIdKey": "OcRequestId", # If set Ocelot will try and use service discovery to locate downstream hosts and ports "ServiceDiscoveryProvider": { "Provider":"Consul", "Host":"localhost", "Port":8500 } } }