Hey
How do I use the “UseHttps": true” in the appsettings, in a setup where the ssl are not handled by the servers ? ![]()
Any suggenstions for that?
Best Thomas
Hey
How do I use the “UseHttps": true” in the appsettings, in a setup where the ssl are not handled by the servers ? ![]()
Any suggenstions for that?
Best Thomas
Hey Thomashdk ![]()
You need to configure forwarded headers and a known proxy/proxies.
This is how I’ve done it on my personal project, which is behind a Traefik proxy:
// Forward headers needed to pass information from the reverse proxy to the application
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders =
ForwardedHeaders.XForwardedFor |
ForwardedHeaders.XForwardedProto |
ForwardedHeaders.XForwardedHost;
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("172.28.0.0"), 16));
});
// This is needed to forward the headers from the reverse proxy to the application
app.UseForwardedHeaders();
Lots of more info on the use of forwarded headers and load balancer setups for .NET can be found here:
Thanks! I will try that !