fix: add use forwarded headers and clear known
All checks were successful
Build and Deploy Docker Container / build-and-deploy (push) Successful in 1m39s
.NET Test Pipeline / build-and-test (push) Successful in 2m20s

This commit is contained in:
Polianin Nikita 2024-07-08 00:00:32 +03:00
parent 3326b17d74
commit 497b7f146b

View File

@ -84,6 +84,8 @@ public class Program
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.ForwardedForHeaderName = secretForward.SecretForwardToken + "-X-Forwarded-For"; options.ForwardedForHeaderName = secretForward.SecretForwardToken + "-X-Forwarded-For";
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
}); });
builder.Services.AddCustomApiVersioning(); builder.Services.AddCustomApiVersioning();
@ -94,6 +96,7 @@ public class Program
var app = builder.Build(); var app = builder.Build();
app.UseForwardedHeaders();
app.UseStaticFiles(UrlHelper.GetSubPath.TrimEnd('/')); app.UseStaticFiles(UrlHelper.GetSubPath.TrimEnd('/'));
app.UseCors("AllowAll"); app.UseCors("AllowAll");
app.UseCustomSerilog(); app.UseCustomSerilog();