-
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
Failing to ReRoutes leads to 404 when omitting "/api/" in get url #465
Comments
Ok, I just found something using another project. There's a difference between the ocelot.json I want to use and the one used in the bin folder (looks generated). Any help on setting this up so the file used is the one I edit please ? THanks ! |
Further investigation lead to a fix. Simply renamed my ocelot.json to oselot.global.json. From the sample I've seen on github, it might be a bug. Any feedback appreciated ! Thanks ! |
@Ehrys thanks for your interest in Ocelot. You should have a ocelot.json for each environment you want to work in e.g. ocelot.development.json, ocelot.staging.json, ocelot.production.json or something. However you should just be able to add ocelot.json and everything will work ok if you do .AddJsonFile("ocelot.json") Let me know if you are still having problems? |
@anktsrkr as per @TomPallister I was expecting having only the ocelot.json file to work (as it's supposed to work when using .AddJsonFile but seems not to be working with AddOcelot). @TomPallister I fixed it by renaming my ocelot.json to ocelot.global.json, anyway I was expecting the AddOcelot to work with a simple ocelot.json file but I missread the doc's regex (note that "ocelot..json" matches the doc's regex). Thank you both for your help ! |
Where the heck do you put this .addJsonFile("ocelot.json") ? Everyone says "oh yeah use this", but they never say where! |
you need to put inside the program.cs or startup.cs for example in program.cs
|
As part of a test in order to later use Ocelot, I built a mock project using " https://www.c-sharpcorner.com/article/building-api-gateway-using-ocelot-in-asp-net-core/ ", updated it to work with NetCore 2.1/Ocelot 8 and started playing with it.
The project is a Core console project as gateway using 2 core web api (except for names, they're identical thanks to copy paste).
I have a problem with ReRouting one of the API I'm using. I can access the "customers" api using localhost:5000/customers but I have to use localhost:5000/api/products if I want to access the "products" one. Note that I can access BOTH of them (but with an unexpected route for one).
Am I missing something ?
This is the Gateway.zip project (ocelot.json included), let me know if you need anything else.
Thanks !
Expected Behavior
Free access to "products" without having to put "/api/" in the url.
Actual Behavior
404 when trying to access localhost:5000/products.
Specifications
The text was updated successfully, but these errors were encountered: