try
continuous-integration/drone/push Build is passing Details

pull/10/head
David D'ALMEIDA 1 year ago
parent 6dd73d34a7
commit 3849147b2d

@ -189,8 +189,8 @@ public class AppBootstrap(IConfiguration configuration)
{
options.PreSerializeFilters.Add((swagger, httpReq) =>
{
if (httpReq.Headers.ContainsKey("X-Forwarded-Host"))
{
//if (httpReq.Headers.ContainsKey("X-Forwarded-Host"))
// {
//The httpReq.PathBase and httpReq.Headers["X-Forwarded-Prefix"] is what we need to get the base path.
//For some reason, they returning as null/blank. Perhaps this has something to do with how the proxy is configured which we don't have control.
//For the time being, the base path is manually set here that corresponds to the APIM API Url Prefix.
@ -198,15 +198,11 @@ public class AppBootstrap(IConfiguration configuration)
var basePath = "containers/HeartDev-api";
var serverUrl = $"{httpReq.Scheme}://{httpReq.Headers["X-Forwarded-Host"]}/{basePath}";
swagger.Servers = new List<OpenApiServer> { new OpenApiServer { Url = serverUrl } };
}
swagger.Servers = new List<OpenApiServer> { new() { Url = serverUrl }, new() { Url = $"{httpReq.Scheme}://{httpReq.Host.Value}" },new() { Url = $"{httpReq.Scheme}://{httpReq.Host.Value}/{basePath}" } };
//}
});
});
app.UseSwaggerUI(options =>
{
options.RoutePrefix = string.Empty;
options.SwaggerEndpoint("swagger/v1/swagger.json", "My Api (v1)");
});
app.UseSwaggerUI();
app.MapSwagger();
/* app.UseSwaggerUI(options =>
{

Loading…
Cancel
Save