Burgyn / MMLib.SwaggerForOcelot

This repo contains swagger extension for ocelot.
MIT License
353 stars 94 forks source link

With version 1.9.0 the http scheme is duplicated #121

Closed fr4nky80 closed 4 years ago

fr4nky80 commented 4 years ago

Describe the bug Only happens with swagger version 2 SwaggerForOcelotMiddleware method invoke, you use this:

  var hostName = endPoint.EndPoint.HostOverride ?? UriHelper.BuildAbsolute(context.Request.Scheme, context.Request.Host).RemoveSlashFromEnd();

but in version 1.4.0 use this:

 var hostName = endPoint.EndPoint.HostOverride ?? context.Request.Host.Value;

this makes the HTTP requests duplicate the scheme, example:

http://http://localhost

Expected behavior should be localhost but it's http://localhost, which means that the api calls are incorrect since it includes twice the scheme.

To Reproduce just include version 1.9.0 and expose a service from the gw.

Burgyn commented 4 years ago

Hi, thanks for your issue.

This issue looks the same as #117.

I'll try to fix it next week. As a tempolary workaround, you can try to setting the HostOverride property to "".

  "SwaggerEndPoints": [
    {
      "Key": "user",
      "HostOverride": "",
      "Config": [
        {
          "Name": "User API",
          "Version": "v1",
          "Url": "http://localhost:7071/api/swagger.json"
        }
      ]
    }
  ],
fr4nky80 commented 4 years ago

Thanks this works!!!