Skip to content

Commit d3b7fb9

Browse files
committed
In prod behind loadbalancers, the application server is still runing HTTP
1 parent 576bf14 commit d3b7fb9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

NorthwindCRUD/Program.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,15 @@
150150

151151
app.UseGraphQL();
152152

153-
app.UseSwagger();
153+
app.UseSwagger(c =>
154+
{
155+
c.PreSerializeFilters.Add((swagger, httpReq) =>
156+
{
157+
// Adding server base address in the generated file relative to the server's host
158+
swagger.Servers = new List<OpenApiServer> { new OpenApiServer { Url = $"https://{httpReq.Host.Value}" } };
159+
});
160+
});
161+
154162
app.UseSwaggerUI();
155163
app.UseSeedDB();
156164

0 commit comments

Comments
 (0)