Skip to content
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

Error with gateway hosted under https://example.com/internal-gateway instead of https://example.com #292

Open
jducobu opened this issue Apr 3, 2024 · 0 comments
Assignees

Comments

@jducobu
Copy link

jducobu commented Apr 3, 2024

I use dotnet 8 and the nuget package 8.2.0 without updating the ocelot package (a new version 23.2.0 was released).
The ocelot gatewat is accessible from the url https://example.com/internal-gateway/...
I use this code to configure the SwaggerForOcelot (simimlar from the demos found on this repos)

string prefix = "/internal-gateway";

app.UsePathBase(prefix);
app.UseSwaggerForOcelotUI(opt =>
{
    opt.DownstreamSwaggerEndPointBasePath = $"{prefix}/swagger/docs";
    opt.PathToSwaggerGenerator = "/swagger/docs";
}).UseOcelot().GetAwaiter().GetResult();

image

Expected behavior
The swagger ui has to load the swagger configuration from https://example.com/internal-gateway/swagger/docs/v1/forms-api as expected (see the printscreen below) and not https://example.com//swagger/docs/v1/forms-api

image

To Reproduce
The Ocelot route configuration:

"GlobalConfiguration": {
  "BaseUrl": "https://example.com/internal-gateway"
},
"Routes": [
  {
    "DownstreamPathTemplate": "/forms/{everything}",
    "DownstreamScheme": "https",
    "DownstreamHostAndPorts": [
      {
        "Host": "localhost",
        "Port": 33031
      }
    ],
    "UpstreamPathTemplate": "/forms-api/{everything}",
    "UpstreamHttpMethod": [ "Get", "Post" ],
    "SwaggerKey": "forms-api"
  }
],
"SwaggerEndPoints": [
  {
    "Key": "forms-api",
    "Config": [
      {
        "Name": "Forms Api",
        "Version": "v1",
        "Url": "https://localhost:33031/swagger/v1/swagger.json"
      }
    ]
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants