diff --git a/src/JoinRpg.Portal/Startup.cs b/src/JoinRpg.Portal/Startup.cs index f5df88932..a019f8416 100644 --- a/src/JoinRpg.Portal/Startup.cs +++ b/src/JoinRpg.Portal/Startup.cs @@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Mvc; @@ -103,6 +104,12 @@ public void ConfigureServices(IServiceCollection services) .AddAuthentication() .ConfigureJoinExternalLogins(Configuration.GetSection("Authentication")); + services.Configure(options => + { + options.ForwardedHeaders = + ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; + }); + _ = services.AddSwaggerGen(Swagger.ConfigureSwagger); _ = services.AddApplicationInsightsTelemetry(); @@ -157,9 +164,12 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) } }); + _ = app.UseForwardedHeaders(); + + _ = app + .UseSwagger(Swagger.Configure) + .UseSwaggerUI(Swagger.ConfigureUI); - _ = app.UseSwagger(Swagger.Configure); - _ = app.UseSwaggerUI(Swagger.ConfigureUI); if (!env.IsDevelopment()) { _ = app.UseHttpsRedirection();