diff --git a/Site5/Master-v5.master.cs b/Site5/Master-v5.master.cs index bda38841..f5b86f99 100644 --- a/Site5/Master-v5.master.cs +++ b/Site5/Master-v5.master.cs @@ -61,10 +61,15 @@ namespace Swarmops // Check for SSL and force it - string cloudFlareVisitorScheme = Request.Headers["CF-Visitor"]; + // Special case for CloudFlare deployments - there is a case where somebody will get their connections de-SSLed at the server + string cloudFlareVisitorScheme = Request.Headers["CF-Visitor"]; bool cloudFlareSsl = (cloudFlareVisitorScheme.Contains("\"scheme\":\"https\"") ? true : false); + // TODO: Same thing for Pound deployments + + // Rewrite if applicable + 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-")) diff --git a/Site5/Security/Login.aspx.cs b/Site5/Security/Login.aspx.cs index cc5f0ecb..ab92ed96 100644 --- a/Site5/Security/Login.aspx.cs +++ b/Site5/Security/Login.aspx.cs @@ -32,9 +32,14 @@ namespace Swarmops.Pages.Security // Check for SSL and force it - string cloudFlareVisitorScheme = Request.Headers["CF-Visitor"]; + // Special case for CloudFlare deployments - there is a case where somebody will get their connections de-SSLed at the server - bool cloudFlareSsl = (cloudFlareVisitorScheme.Contains("\"scheme\":\"https\"")? true: false); + string cloudFlareVisitorScheme = Request.Headers["CF-Visitor"]; + bool cloudFlareSsl = (cloudFlareVisitorScheme.Contains("\"scheme\":\"https\"") ? true : false); + + // TODO: Same thing for Pound deployments + + // Rewrite if applicable if (Request.Url.ToString().StartsWith("http://") && !cloudFlareSsl) // only check client-side as many server sites de-SSL the connection before reaching the web server {