mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
UseForwardedHeadersForAzure
This commit is contained in:
@ -8,8 +8,10 @@ using IdentityModel;
|
||||
using IdentityServer4.Services;
|
||||
using IdentityServer4.Stores;
|
||||
using IdentityServer4.Validation;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -170,5 +172,20 @@ namespace Bit.Core.Utilities
|
||||
services.AddSingleton(s => globalSettings);
|
||||
return globalSettings;
|
||||
}
|
||||
|
||||
public static void UseForwardedHeadersForAzure(this IApplicationBuilder app)
|
||||
{
|
||||
// ref: https://github.com/aspnet/Docs/issues/2384
|
||||
var forwardOptions = new ForwardedHeadersOptions
|
||||
{
|
||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto,
|
||||
RequireHeaderSymmetry = false
|
||||
};
|
||||
|
||||
forwardOptions.KnownNetworks.Clear();
|
||||
forwardOptions.KnownProxies.Clear();
|
||||
|
||||
app.UseForwardedHeaders(forwardOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user