forceHTTPS

pull/12/head
Szekeres Bálint 2018-03-09 23:27:39 +01:00
parent 31612124a5
commit cd0b0b4be6
3 changed files with 27 additions and 5 deletions

View File

@ -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';
};

View File

@ -84,6 +84,14 @@
</label>
</div>
</div>
<div class="form-subgroup" ng-if="isHTTPS()" ng-cloak>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="force_https" ng-model="data.force_https">
<label class="form-check-label" for="force_https">
<span tooltips tooltip-template="Force redirection from HTTP to HTTPS.">force HTTPS</span>
</label>
</div>
</div>
<div class="form-subgroup" ng-if="isHTTPS()" ng-cloak>
<div class="form-check">
<input class="form-check-input" type="radio" id="letsencrypt" ng-model="data.cert_type" value="letsencrypt">

View File

@ -1,8 +1,16 @@
server {
listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}{{ isHTTPS() ? '443 ssl' : '80' }}{{ isHTTP2() ? ' http2' : '' }};<!--
server {<!--
✔ IPv6 --><span ng-if="isIPv6()">
listen [{{ data.ipv6 }}]:{{ isHTTPS() ? '443 ssl' : '80' }}{{ isHTTP2() ? ' http2' : '' }};</span>
✘ HTTPS || ✘ forceHTTPS --><span ng-if="!isHTTPS() || !isForceHTTPS()">
listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}80;<!--
✔ IPv6 --><span ng-if="isIPv6()">
listen [{{ data.ipv6 }}]:80;</span></span><!--
✔ HTTPS --><span ng-if="isHTTPS()">
listen {{ data.ipv4 !== '*' ? data.ipv4 + ':' : '' }}443 ssl{{ isHTTP2() ? ' http2' : '' }};<!--
✔ IPv6 --><span ng-if="isIPv6()">
listen [{{ data.ipv6 }}]:443 ssl{{ isHTTP2() ? ' http2' : '' }};</span></span>
server_name {{ isWWW() ? 'www.' : '' }}{{ domain() }};<!--
@ -145,7 +153,7 @@ server {
✔ HTTPS --><span ng-if="isHTTPS()">
forceHTTPS --><span ng-if="isForceHTTPS()">
# HTTP redirect
server {