Reputation: 103
I have created Azure service fabric application with several stateless and stateful services. All my statefull services are accessible via a Web Api stateless service. Now I have added Ocelot API gateway to another stateless web api service and I want to access all my services from that gateway only. Now when I am trying to access the services from my API gateway service, it gives me 404.
Ocelot configurtion
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/product/seed",
"DownstreamScheme": "http",
"UpstreamPathTemplate": "/api/product/randomize",
"UpstreamHttpMethod": [ "Get" ],
"DownstreamHostAndPorts": [
{
"Host": "http://localhost:8314"
}
],
"QoSOptions": {
"TimeoutValue": 360000
}
}
],
"GlobalConfiguration": {
"BaseUrl": "http://localhost:8445"
}
}
What I am missing here?
Upvotes: 2
Views: 1036
Reputation: 10175
If you're debugging locally, you don't need to add the protocol scheme and port on the host configuration man, you can omit the HTTP Traffic from the Host value and include a sibling property for the port (See example below):
{
"DownstreamPathTemplate": "/api/user/",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "demo.api.gateway",
"Port": 52792
}
],
"UpstreamPathTemplate": "/api/user/",
"UpstreamHttpMethod": [ "Get" ]
},
BTW, I've written an API gateway tutorial about API gateways and ASP.net Core + Ocelot, if you're interested to learn more about API gateways, you might want to check this article:
https://www.pogsdotnet.com/2018/08/api-gateway-in-nutshell.html
Hope it helps!
Allan
Upvotes: 0