From 6eba31c7869c85105adf78456761797c44b5da0d Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Mon, 8 Sep 2014 19:07:39 +0000 Subject: [PATCH] SSL detection is piss poor, so enforcing SSL in a reverse-proxy scenario causes endless redirect loops. Must find better way to detect whether SSL has been used (with CloudFlare, Pound, etc.) Until then, disable SSL enforcer. --- Site5/Master-v5.master.cs | 5 +++-- Site5/Security/Login.aspx.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Site5/Master-v5.master.cs b/Site5/Master-v5.master.cs index bb50f6a7..9f9271ad 100644 --- a/Site5/Master-v5.master.cs +++ b/Site5/Master-v5.master.cs @@ -61,7 +61,8 @@ namespace Swarmops // Check for SSL and force it - if ((!Request.IsSecureConnection) && Request.Url.ToString().StartsWith("http://")) // Both are necessary, as some reverse proxies will https-ify an original nonsecure connection. First is state at server, second is state at client + /* 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 { 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-")) { @@ -70,7 +71,7 @@ namespace Swarmops // Only force this if set to force it in database // TODO: Make admin init task } - } + }*/ Localize(); diff --git a/Site5/Security/Login.aspx.cs b/Site5/Security/Login.aspx.cs index 84a972ac..9b51247a 100644 --- a/Site5/Security/Login.aspx.cs +++ b/Site5/Security/Login.aspx.cs @@ -33,7 +33,7 @@ namespace Swarmops.Pages.Security // Check for SSL /* DISABLE temporarily - if ((!Request.IsSecureConnection) && Request.Url.ToString().StartsWith("http://")) // Both are necessary, as some reverse proxies will https-ify an original nonsecure connection + if ((!Request.IsSecureConnection) && (!Request.Url.ToString().StartsWith("https://"))) // Both are necessary, as some reverse proxies will https-ify an original nonsecure connection { if (!Request.Url.ToString().StartsWith("http://dev.swarmops.com/") && !Request.Url.ToString().StartsWith("http://localhost:") && !Request.Url.ToString().StartsWith("http://swarmops-")) {