GithubHelp home page GithubHelp logo

Comments (8)

Burgyn avatar Burgyn commented on June 20, 2024

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.

Prod0 avatar Prod0 commented on June 20, 2024

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.

Burgyn avatar Burgyn commented on June 20, 2024

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.

Prod0 avatar Prod0 commented on June 20, 2024

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.

Prod0 avatar Prod0 commented on June 20, 2024

@Burgyn please

from mmlib.swaggerforocelot.

Burgyn avatar Burgyn commented on June 20, 2024

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.

github-actions avatar github-actions commented on June 20, 2024

Closing after 8 days of waiting for the additional info requested.

from mmlib.swaggerforocelot.

Prod0 avatar Prod0 commented on June 20, 2024

Hello @Burgyn, where can I send you the demo project, sorry for the delay.

from mmlib.swaggerforocelot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.