mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 20:28:15 +08:00
Now defaults to case insensitive routing but you can override with a setting, also global request id setting available
This commit is contained in:
@ -1,70 +1,80 @@
|
||||
"ReRoutes": [
|
||||
{
|
||||
# The url we are forwarding the request to
|
||||
"UpstreamTemplate": "/identityserverexample",
|
||||
# The path we are listening on for this re route
|
||||
"UpstreamTemplate": "/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"
|
||||
{
|
||||
"ReRoutes": [
|
||||
{
|
||||
# The url we are forwarding the request to
|
||||
"UpstreamTemplate": "/identityserverexample",
|
||||
# The path we are listening on for this re route
|
||||
"UpstreamTemplate": "/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
|
||||
},
|
||||
# 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 }
|
||||
# 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",
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user