Rebase your API paths at Swashbuckle preserialization
Configuration:
app.UseSwagger
(
options =>
{
options.PreSerializeFilters.Add((swagger, httpReq) =>
{
if (!string.IsNullOrWhiteSpace(httpReq?.Host.Value))
{
swagger.Servers.Add
(
new OpenApiServer { Url = $"{httpReq.Scheme}://{httpReq.Host.Value}{{basePath}}" }
.WithVariable("basePath", new OpenApiServerVariable { Default = "/test" })
);
}
});
options.RemoveRoot("/test");
}
);