-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect to gateway api #730
Comments
The request should be made to http://localhost/api/survey-gateway according to your config... |
Agreed with Margaale -- I think you are bypassing Ocelot and going directly to the downstream host unless there is something I am missing here. |
I tried, but got And here is my output in asp.net core:
|
Do not use por 51891 that's the API port, your gateway port is different, probably 80 if you didn't touch the defaults |
Wait, are you running your api and the gateway in the same app? |
I tried sending the request to this url, but of course, it is 404, because I'm running the web application in DEBUG mode of Visual Studio 2017. My API & my gateway are different projects. http://localhost:51981/api/gateway/survey And I dont want to expose that api from client, therefore, I configure an Upstream end-point, such as: http://localhost:51981/api/survey-gateway That means, in POSTMAN, when I make request to http://localhost:51981/api/survey-gateway, my request will be transparently redirected to http://localhost:51981/api/gateway/survey. For now, it is 404, not found. |
Could you post your configuration file with all the routes? |
This is my GateWayController.cs
This is my Startup.cs
My ocelot.json
|
And program.cs please |
Here you are, my program.cs
|
Ohh. I see. Unless I'm mistaken this can't be achieved. Both Middlewares are final in the pipeline. @philproctor what do you think? Can we modify the code to allow ocelot call the next Middleware if the route isn't found in the configuration? Just an idea, I haven't inspect that part of the code yet |
No need for that -- the ordering is controlled by Configure() and ConfigureServices() in Startup.cs -- MVC will continue the pipeline if no controller handles the request. Ocelot is intended to be the last middleware in the chain. @redplane your code will work if you move AddMvc() and UseMvc() to before AddOcelot() and UseOcelot() respectively in your Startup.cs |
You are absolutly correct. I was trying to achive that with nancy and was not able to... Sorry for the confusion. @redplane your startup.cs should look like:
|
Safe to close this issue? |
I would say so. But I was waiting for his confirmation
…On Fri, Jan 4, 2019, 19:55 Phil Proctor ***@***.*** wrote:
Safe to close this issue?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#730 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AT1ONjVTJzTdMtmwckV3sWftVbNJpCH6ks5u_9vkgaJpZM4Zkz7L>
.
|
Thank you for your help. This issue can be closed now :). |
Expected Behavior / New Feature
When I make request to ocelot gateway, I want the request to be redirected to the api comes from controller in Ocelot.
Actual Behavior / Motivation for New Feature
404 Not found returned.
Steps to Reproduce the Problem
http://localhost:51981/api/survey-gateway
(http://localhost:51981/api/gateway/survey) is the address of
GatewayController
in Gateway API.Specifications
The text was updated successfully, but these errors were encountered: