-
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
Upgrade to 3.1 produces empty ocelot.json #1247
Comments
Update: If I downgrade Ocelot to latest 15 version (v15.0.7), the configuration (ocelot.json) is back again, with .NET Core 3.1. So narrowing down the problem, the empty configuration only occurs in: v16.0.0 & v16.0.1 |
Thank you for sharing, i spent a lot of time resolving this bug |
I've also found the 16 versions have an issue where it seems to break JWT authentication. Running 15.0.7 everything was fine. If I upgrade to 16.0.x and rename "ReRoutes" to "Routes" in the appsettings.json, the basic routes seem ok but when I inspect the Identity in the context it's not translating claims correctly. I don't have a simple case to post yet, but it seems like there's a step missing for the config upgrade or something is very broken. |
It looks like this is caused by this method:
And specifically by this line:
I followed the config from this answer for .NET Core 3.1. But did the following instead: -config.AddOcelot("your folder", hostingContext.HostingEnvironment);
+config.AddJsonFile($"ocelot.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true); So avoiding the call to
So it looks like it's by design and not a bug! |
@mkanakis Hi Marios! I see you fought with Ocelot config files for different environments. |
…ration construction (#1569) * Added AddOcelot Configbuilder Overload Added an AddOcelot overload to load FileConfiguration directly from the application, so that all the routes could be made configurable and could be load from anywhere. * Code review changes * Added unit tests for ConfigurationBuilder AddOcelot method overload * code review * CA1816 Change ConfigurationReloadTests.Dispose() to call GC.SuppressFinalize(object). This will prevent derived types that introduce a finalizer from needing to re-implement 'IDisposable' to call it. * SYSLIB1045 Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. * SA1601 Partial elements should be documented * Add developer's XML-docs --------- Co-authored-by: raman-m <[email protected]>
We don't support .NET Core 3.x since 16.0.2 release. If the issue still persists, please open new issue/PRs. |
Expected Behavior
In .NET Core 2.2, inside the Startup constructor we have the following configuration:
In ConfigureServices we use the following line to add Ocelot as a middleware:
As you can see, we specify a certain path for merging ocelot files for different environments.
After upgrading to .NET Core 3.1 the only difference is in Configure method:
The above snippets should merge all ocelot.*.json files into ocelot.json and work as intended. At least with 2.2 that was the case.
Actual Behavior
In 3.1, the generated ocelot.json is empty! So every request leads to => 404
One thing I noticed is in this line:
It used to get the ContentRootPath and add the rest {gateway}/{env.name}.
Instead, it goes to "C:/" now. I fixed this by adding the ContentRootPath in front, but still the generated routing config is empty.
Produced ocelot.json:
Specifications
The text was updated successfully, but these errors were encountered: