forked from ThreeMammals/Ocelot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration-explanation.txt
103 lines (103 loc) · 4.98 KB
/
configuration-explanation.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{
"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
}
}
}