I use Ocelot for api gateway and encountered problem with configuration. I'm trying to replace part of the 'Location' header value that comes from api (when api returns CreatedAtRoute(...)
result).
See part of ocelot.json:
// ...
{
"UpstreamPathTemplate": "/hotels",
"UpstreamHttpMethod": [ "Post", "Put" ],
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "<api_host>",
"Port": 80
}
],
"DownstreamPathTemplate": "/api/hotels",
"DownstreamHeaderTransform": {
"Location": "{DownstreamBaseUrl}/api, {BaseUrl}" // the issue here
}
},
// ...
What I want in headers when posting new object (42 is just random number):
Location: http://<gateway_host>/hotels/42
What I actually get:
Location: http://<api_host>/api/hotels/42
May be it doesn't matter but both apps are running in docker.