From cd0b0b4be6928e7747463ae981bd5ba7476f5d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szekeres=20Ba=CC=81lint?= Date: Fri, 9 Mar 2018 23:27:39 +0100 Subject: [PATCH] forceHTTPS --- public/assets/js/app.js | 6 ++++++ public/index.html | 8 ++++++++ public/templates/conf/example.com.conf.html | 18 +++++++++++++----- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/public/assets/js/app.js b/public/assets/js/app.js index 3767c02..e654c16 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -35,6 +35,8 @@ https: false, http2: true, + force_https: true, + cert_type: 'letsencrypt', email: '', ssl_certificate: '', @@ -270,6 +272,10 @@ return $scope.isHTTPS() && $scope.data.http2; }; + $scope.isForceHTTPS = function() { + return $scope.isHTTPS() && $scope.data.force_https; + }; + $scope.isLetsEncrypt = function() { return $scope.isHTTPS() && $scope.data.cert_type === 'letsencrypt'; }; diff --git a/public/index.html b/public/index.html index 8441d05..47df12b 100644 --- a/public/index.html +++ b/public/index.html @@ -84,6 +84,14 @@ +
+
+ + +
+
diff --git a/public/templates/conf/example.com.conf.html b/public/templates/conf/example.com.conf.html index e33dbbe..b2d1e55 100644 --- a/public/templates/conf/example.com.conf.html +++ b/public/templates/conf/example.com.conf.html @@ -1,8 +1,16 @@ -server { - listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}{{ isHTTPS() ? '443 ssl' : '80' }}{{ isHTTP2() ? ' http2' : '' }}; - listen [{{ data.ipv6 }}]:{{ isHTTPS() ? '443 ssl' : '80' }}{{ isHTTP2() ? ' http2' : '' }}; + ✘ HTTPS || ✘ forceHTTPS --> + listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}80; + listen [{{ data.ipv6 }}]:80; + listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}443 ssl{{ isHTTP2() ? ' http2' : '' }}; + listen [{{ data.ipv6 }}]:443 ssl{{ isHTTP2() ? ' http2' : '' }}; server_name {{ isWWW() ? 'www.' : '' }}{{ domain() }}; +✔ forceHTTPS --> # HTTP redirect server {