I have two api's api A and api B and all controllers are the same for two APIs.
I want to redirect Api A if my request url includes client=A
Example : https://localhost:7259/api/login?client=A
I tried to add "client" to AddHeadersToRequest in Ocelot.json but it didn't work.
When I set it like this, it gave an error that there cannot be two of the same route.({everything})
{
"Routes": [
{
"DownstreamPathTemplate": "/api/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 40411
}
],
"UpstreamPathTemplate": "/api/{everything}",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE", "PATCH" ],
"SwaggerKey": "APIA",
"Key": "APIA",
"RouteIsCaseSensitive": false,
"Match": {
"Key": "Client",
"Value": "APIA"
},
"AddHeadersToRequest": {
"client": "APIA"
}
},
{
"DownstreamPathTemplate": "/api/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 53639
}
],
"UpstreamPathTemplate": "/api/{everything}",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE", "PATCH" ],
"SwaggerKey": "APIB",
"Key": "APIB",
"RouteIsCaseSensitive": false,
"Match": {
"Key": "Client",
"Value": "APIB"
},
"AddHeadersToRequest": {
"client": "APIB"
}
}
],
"GlobalConfiguration": {
"BaseUrl": "https://localhost:7259/"
}
}
Do you have any recommendations ?