How to map internal endpoint in Ocelot API gateway? #2183
-
When i use |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hello, Sachin! What endpoints are you referring to? How were they established? What is the actual type of the 404 error? Could you please extract the logs? Did you mean the Ocelot controller endpoints or user type ones? Could you provide the complete C# code? |
Beta Was this translation helpful? Give feedback.
-
Ocelot is not designed to host endpoints because it's a routing software! It doesn't act as an API endpoint host; instead, Ocelot functions as a traffic router based on routes and URL paths ❕ At last, Ocelot functions as a reverse proxy!
404 is correct behavior. In Getting Started chapter we don't recommend attaching additional endpoints via
Your small minimal API endpoint suggests that you intend to use it as a downstream service. Deploy and implement this service independently from Ocelot, and ensure your client connects directly to this endpoint without relying on Ocelot routing ❗ It's entirely up to you whether to route the traffic using Ocelot as a route or not. If the recipes mentioned in #1949 don't work, there might be an undocumented configuration, the MapWhenOcelotPipeline property, introduced by PR #416 (refer to commit 5c940ac). It wasn’t originally intended as a feature, so it wasn’t thoroughly tested, but it seems like it could serve as a feature for extending the Ocelot pipeline with additional endpoints. |
Beta Was this translation helpful? Give feedback.
Ocelot is not designed to host endpoints because it's a routing software! It doesn't act as an API endpoint host; instead, Ocelot functions as a traffic router based on routes and URL paths ❕ At last, Ocelot functions as a reverse proxy!
404 is correct behavior. In Getting Started chapter we don't recommend attaching additional endpoints via
app.Map*
methods. The Ocelot pipeline is not compatible with classic API endpoints for hosting.