79500420

Date: 2025-03-11 10:36:11
Score: 0.5
Natty:
Report link

After below changes, I am able to access individual API and also via ocelot gateway using docker.

- Removed ports definition from docker-compose.yml
- In ocleot.json included service name as host and port as 8080
- Exposed only 8080 as port from API's docker file

Final ocelot.json

{
"Routes": [
{
"DownstreamPathTemplate": "/api/products",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "productservice",
"Port": 8080
}
],
"UpstreamPathTemplate": "/products",
"UpstreamHttpMethod": [ "Get" ]
},
]
}

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: chint