Disabling SSL enforcers was a REALLY bad idea. Adding special case for CloudFlare instead - it's a common enough deployment.
This commit is contained in:
@@ -61,8 +61,11 @@ namespace Swarmops
|
||||
|
||||
// Check for SSL and force it
|
||||
|
||||
/* DISABLED - WORKS REALLY POORLY WHEN IN COMPLEX DEPLOYMENTS. MUST IMPROVE DETECTION MECHANISM
|
||||
if (Request.Url.ToString().StartsWith("http://")) // only check client-side as many server sites de-SSL the connection before reaching the web server
|
||||
string cloudFlareVisitorScheme = Request.Headers["CF-Visitor"];
|
||||
|
||||
bool cloudFlareSsl = (cloudFlareVisitorScheme == "\"scheme\":\"https\""? true: false);
|
||||
|
||||
if (Request.Url.ToString().StartsWith("http://") && !cloudFlareSsl) // only check client-side as many server sites de-SSL the connection before reaching the web server
|
||||
{
|
||||
if (!Request.Url.ToString().StartsWith("http://dev.swarmops.com/") && !Request.Url.ToString().StartsWith("http://sandbox.swarmops.com") && !Request.Url.ToString().StartsWith("http://localhost:") && !Request.Url.ToString().StartsWith("http://swarmops-"))
|
||||
{
|
||||
@@ -71,7 +74,7 @@ namespace Swarmops
|
||||
// Only force this if set to force it in database
|
||||
// TODO: Make admin init task
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Localize();
|
||||
|
||||
|
||||
@@ -30,16 +30,19 @@ namespace Swarmops.Pages.Security
|
||||
this.LabelLoginFailed.Visible = false;
|
||||
this.TextLogin.Focus();
|
||||
|
||||
// Check for SSL
|
||||
// Check for SSL and force it
|
||||
|
||||
/* DISABLE temporarily
|
||||
if ((!Request.IsSecureConnection) && (!Request.Url.ToString().StartsWith("https://"))) // Both are necessary, as some reverse proxies will https-ify an original nonsecure connection
|
||||
string cloudFlareVisitorScheme = Request.Headers["CF-Visitor"];
|
||||
|
||||
bool cloudFlareSsl = (cloudFlareVisitorScheme == "\"scheme\":\"https\""? true: false);
|
||||
|
||||
if (Request.Url.ToString().StartsWith("http://") && !cloudFlareSsl) // only check client-side as many server sites de-SSL the connection before reaching the web server
|
||||
{
|
||||
if (!Request.Url.ToString().StartsWith("http://dev.swarmops.com/") && !Request.Url.ToString().StartsWith("http://localhost:") && !Request.Url.ToString().StartsWith("http://swarmops-"))
|
||||
{
|
||||
Response.Redirect(Request.Url.ToString().Replace("http:", "https:"));
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
protected void ButtonLogin_Click(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user