1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

Support for reverse proxy in setup script (#139)

* Added option for when using reverse proxy to setup script

* Removed debug console.write
This commit is contained in:
Viktor Hansson 2017-11-20 13:53:38 +01:00 committed by Kyle Spearrin
parent 448ab08b19
commit afd72b26eb

View File

@ -123,6 +123,51 @@ namespace Bit.Setup
}
}
Console.Write("(!) Is your installation behind a reverse proxy? (y/n): ");
var reverseProxy = Console.ReadLine().ToLowerInvariant() == "y";
if(reverseProxy)
{
Console.Write("(!) Do you use the default ports on your reverse proxy (80/443)? (y/n): ");
var proxyDefaultPorts = Console.ReadLine().ToLowerInvariant() == "y";
if(proxyDefaultPorts)
{
url = ssl ? $"https://{domain}" : $"http://{domain}";
}
else
{
int httpReversePort = default(int), httpsReversePort = default(int);
Console.Write("(!) HTTP port: ");
if(int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out httpReversePort))
{
if(ssl)
{
Console.Write("(!) HTTPS port: ");
if(int.TryParse(Console.ReadLine().ToLowerInvariant().Trim(), out httpsReversePort))
{
if(httpsReversePort != 443)
{
url += (":" + httpsReversePort);
}
}
else
{
Console.WriteLine("Invalid HTTPS port.");
httpReversePort = httpsReversePort = default(int);
}
}
else if(httpReversePort != 80)
{
url += (":" + httpReversePort);
}
}
else
{
Console.WriteLine("Invalid HTTP port.");
}
}
}
Console.Write("(!) Do you want to use push notifications? (y/n): ");
var push = Console.ReadLine().ToLowerInvariant() == "y";