Comments (8)
Hi @Prod0,
If you use it in Postman, your path is /swagger/docs/v1/multitenant
(without /api
). But in the Not Found message it is /api/swagger/docs/v1/multitenant
(with /api
).
Try to remove the "VirtualDirectory":"/api"
parameter from the route definition.
from mmlib.swaggerforocelot.
I tried to remove this parameter, and I receive this error after in my Kibana log
Error Code: UnableToFindDownstreamRouteError Message: Failed to match Route configuration for upstream path: /swagger/docs/v1/multitenant, verb: GET. errors found in ResponderMiddleware. Setting error response for request path:/swagger/docs/v1/multitenant, request method: GET"
Also I forgot to mention that the multitenant service required authentication, it's not public opened, so even if config is correct I will get error 401, and gateway swagger doesn't have any possibility to authenticate and after to send the token to down stream API.
Also here there is the configuration of multitenant API
app.UseSwagger(c =>
{
c.RouteTemplate = "api/swagger/docs/{documentName}/swagger.json";
});
app.UseSwaggerUI(options =>
{
options.RoutePrefix = "api/swagger";
options.SwaggerEndpoint("/api/swagger/docs/v1/swagger.json", "Multitenant API");
});
from mmlib.swaggerforocelot.
How is it possible that when you call it from Postman without /api
you get the correct data even if you have api/swagger/docs/{documentName}/swagger.json
configured in the downstream service?
Authorization. SwaggerUI calls Ocelot first, where the middleware calls the downstream service. So the call to the downstream service does not happen directly. If you need to add some headers for authorization, you can use
app.UseSwaggerForOcelotUI(opt => {
opt.DownstreamSwaggerHeaders = new[]
{
new KeyValuePair<string, string>("Auth-Key", "AuthValue"),
};
})
from mmlib.swaggerforocelot.
Ok my bad I was using this URL : api/multitenant/swagger/index.html ... in the postman, sorry for that.
the thing is that we dont call locally domain/api/swagger/docs/{documentName}/swagger.json
but domain/api/multitenant/swagger/docs/v1/swagger.json
But regarding to the DownstreamHeaders,
The error is that we cant find the upstream route
if we can get from multitenant any error code that we could set some headers but we didnt reach this step
we only asking gateway and it reply sorry url is not matching configuration
also we run swagger : https://domain/swagger/index.html without api prefix where multitenant require api prefix
from mmlib.swaggerforocelot.
@Burgyn please
from mmlib.swaggerforocelot.
Hi, I'm sorry but I can't help you much. Can you please isolate this behavior into a demo example and provide it to me?
from mmlib.swaggerforocelot.
Closing after 8 days of waiting for the additional info requested.
from mmlib.swaggerforocelot.
Hello @Burgyn, where can I send you the demo project, sorry for the delay.
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
- Failed to load API definition issue HOT 17
- 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.