mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
Platform/pm 2138/add nginx to known proxies (#3012)
* Add nginx to known proxies * Only add nginx proxy if standard self host deployment * Style changes * Add forwarded headers config to events server * Add known proxy forwarding to missing services * Catch DNS errors in adding nginx proxy * Update src/SharedWeb/Utilities/ServiceCollectionExtensions.cs Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com> --------- Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
This commit is contained in:
@ -540,10 +540,17 @@ public static class ServiceCollectionExtensions
|
||||
if (!globalSettings.UnifiedDeployment)
|
||||
{
|
||||
// Trust the X-Forwarded-Host header of the nginx docker container
|
||||
var nginxIp = Dns.GetHostEntry("nginx").AddressList.FirstOrDefault();
|
||||
if (nginxIp != null)
|
||||
try
|
||||
{
|
||||
options.KnownProxies.Add(nginxIp);
|
||||
var nginxIp = Dns.GetHostEntry("nginx")?.AddressList.FirstOrDefault();
|
||||
if (nginxIp != null)
|
||||
{
|
||||
options.KnownProxies.Add(nginxIp);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore DNS errors
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user