C
C#11mo ago
M B V R K

Ocelot json Help needed

Hi guys, I'm working on a project using Microservices architecture, as you know with Microservices mostly we need an Api Gateway, I use Ocelot for that purpose. I have the following ocelot.json:
{
"Routes": [
{
"DownstreamPathTemplate" : "/api/Categories",
"DownstreamHostAndPorts":[
{
"Host": "localhost",
"Port": 5196,
"Scheme": "http"
}
],
"UpstreamPathTemplate": "/ExpenseService/api/Categories"
}
]
}
{
"Routes": [
{
"DownstreamPathTemplate" : "/api/Categories",
"DownstreamHostAndPorts":[
{
"Host": "localhost",
"Port": 5196,
"Scheme": "http"
}
],
"UpstreamPathTemplate": "/ExpenseService/api/Categories"
}
]
}
The issue: The issue is the categories controller will contains many actions, so I think that maybe the Ocelot has a feature to tell it to automatically re-route /ExpenseService/api/Categories/{verb} to /api/Categories/{verb}. I have tried /ExpenseService/api/Categories/{everything} to /api/Categories/{everything}, but not working. Please is there any feature or a way to achieve that ?? Massive thanks in advance <3
2 Replies
rmtz
rmtz11mo ago
https://ocelot.readthedocs.io/en/latest/features/routing.html#id1 Although, I'd recommend to stop using Ocelot and switch to YARP. We tried for about a year to make Ocelot work in our use case (api gateway for a mobile payment app) but it's just full of bugs and annoyances and there is literally no support.
M B V R K
M B V R KOP11mo ago
I have tried it (YARP), it looks so good, massive thanks man I appreciate
Want results from more Discord servers?
Add your server