We're a place where coders share, stay up-to-date and grow their careers.
Hi Chris, for proper working and some advanced scenarios you should add the following to your .Net app behind proxy:
public void ConfigureServices(IServiceCollection services) { ... services.Configure<ForwardedHeadersOptions>(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; } ); ... }
Also if you have HSTS and/or CORS settings applied you should remove them as it will become responsibility of your front-end proxy server to handle these:
public void ConfigureServices(IServiceCollection services) { ... //services.AddHsts(options => { // options.MaxAge = TimeSpan.FromDays(365); //}); //services.AddCors(options => //{ // options.AddDefaultPolicy(builder => // { // builder.AllowAnyHeader(); // builder.AllowCredentials(); // builder.AllowAnyMethod(); // builder.AllowAnyOrigin(); // }); //}); ... } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { ... //app.UseCors(); //app.UseHsts(); ... }
Hi Slavius, thanks for the additions here!
Hi Chris,
for proper working and some advanced scenarios you should add the following to your .Net app behind proxy:
Also if you have HSTS and/or CORS settings applied you should remove them as it will become responsibility of your front-end proxy server to handle these:
Hi Slavius, thanks for the additions here!