Comments (17)
Yes, that was the issue. Thanks a lot for your help. It works like a charm now!
from mmlib.swaggerforocelot.
please provide more information. Some logs from your gateway, logs from browsers, ...
Thanks.
from mmlib.swaggerforocelot.
The log from gateway:
RequestPath: /swagger/docs/v1/scheduling
An unhandled exception has occurred while executing the request.
Exception:
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at System.Net.Http.HttpClient.GetStringAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at MMLib.SwaggerForOcelot.Repositories.DownstreamSwaggerDocsRepository.GetSwaggerJsonAsync(RouteOptions route, SwaggerEndPointOptions endPoint, String docsVersion)
at MMLib.SwaggerForOcelot.Middleware.SwaggerForOcelotMiddleware.Invoke(HttpContext context, ISwaggerEndPointProvider swaggerEndPointRepository, IDownstreamSwaggerDocsRepository downstreamSwaggerDocs)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.InvokeCore(HttpContext context, PathString matchedPath, PathString remainingPath)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
from mmlib.swaggerforocelot.
Browser just shows 500 error fetching API definition.
from mmlib.swaggerforocelot.
This is still very general. Please provide your gateway configuration and try to explain how you host in IIS.
If you use Virtual directories
look here: https://github.com/Burgyn/MMLib.SwaggerForOcelot#virtual-directory
Thank you.
from mmlib.swaggerforocelot.
I don't use virtual directory. At this point, I host two sites, Gateway, which is publicly accessible through https, and one microservice that is accessed by gateway via http at the port 5001.
from mmlib.swaggerforocelot.
My gateway configuration:
{
"Routes": [
{
"UpstreamPathTemplate": "/api/scheduling/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"DownstreamPathTemplate": "/api/{everything}",
"DownstreamScheme": "http",
"SwaggerKey": "scheduling",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5001
}
]
}
]
}
from mmlib.swaggerforocelot.
Swagger endpoints:
{
"SwaggerEndPoints": [
{
"Key": "scheduling",
"Config": [
{
"Name": "MyCorp.Services.Scheduling.API",
"Version": "v1",
"Url": "http://localhost:5001/swagger/v1/swagger.json"
}
]
}
]
}
from mmlib.swaggerforocelot.
@Burgyn any idea?
from mmlib.swaggerforocelot.
At the moment, I can't think of anything you might have a problem with. It normally works on IIS. Please check all addresses and ports to see if they match. Also check the logs in the browser (network tab) to see what kind of query the SwaggerUI is sending internally, if there has been any change in the base address.
from mmlib.swaggerforocelot.
This is my Network tab
from mmlib.swaggerforocelot.
Hey @ljubomir-bacovic .
I really want to help you, but without relevant information and your proper investigation it will not work.
Check all logs and configurations properly (ocelot.json
and Startup.cs
).
Check if you can get the swagger.json
for the downstream service directly through the browser http://localhost:5001/swagger/v1/swagger.json
...
Friendly advice. If you are asking for help somewhere then really try to give as much information which can help. Also try to format things sensibly. If something is code (even
JSON
) then format it as code until you can read things. Thank you very much. See markdown docs
from mmlib.swaggerforocelot.
I tried to explain as much as I could. Also, I spent two full days investigating this issue and trying to understand it. There is not much information online, since locally everything works perfectly when I start from Visual Studio. Also, the gateway and the API work on the server as well, we use them to develop frontend. But we would like to have Swagger deployed, so that the frontend team can understand the API better.
from mmlib.swaggerforocelot.
From this url http://localhost:5001/swagger/v1/swagger.json you get correct swagger.json
? If so, try looking at the logs from the gateway to see what address it was trying to forward it to.
I can't help more. So far I haven't had a problem with IIS.
from mmlib.swaggerforocelot.
No, when I try this on the server, I get 404 error.
from mmlib.swaggerforocelot.
So that means that the issue is that Swagger is not working on API level. I will try to investigate that.
from mmlib.swaggerforocelot.
That's good to hear.
from mmlib.swaggerforocelot.
Related Issues (20)
- Swagger for YARP HOT 4
- Documentation -> o.GenerateDocsForGatewayItSelf HOT 1
- Getting 404 when running with KubernetesServiceDiscoveryProvider HOT 1
- Wrong Swagger url generated when using KubernetesServiceDiscoveryProvider HOT 1
- OpenApi fails on reading file HOT 2
- Virtual Directory configuration IIS doesn't work UpstreamPathTemplate 404 not found HOT 1
- Request: Api Search across all swagger docs HOT 2
- Added ApiController to Ocelot Gateway, but gets 404 when requesting it HOT 4
- Ocelot Gateway controllers return enum values as integer instead of string.
- A bug when using .NET8-Ocelot[20.*]
- Status code 500 using 8.1.0 with multiple routes HOT 1
- Failed to load API definition - value cannot be null HOT 1
- getting error when use service discovery HOT 7
- Cant send code_challenge when using SwaggerForOcelot
- Error with gateway hosted under https://example.com/internal-gateway instead of https://example.com
- Using the Consul service discovery, it was found that the request path in the gateway swagger document does not have the "KeyToPath" property attached
- Can you still customize your base URL in newer versions
- The swagger is not shown
- MMLib.SwaggerForOcelot failed to generate aggregate document
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mmlib.swaggerforocelot.