From e36ae58568157a2390e545da62b975f6e73540a6 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Wed, 29 Mar 2023 20:31:29 -0700 Subject: [PATCH] Respect setting to redirect non-SSL to SSL https://forum.virtualmin.com/t/redirect-http-to-https-by-default-for-new-domains-added/119980 --- virtual_feature.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/virtual_feature.pl b/virtual_feature.pl index 943d3dc..1b09c9d 100644 --- a/virtual_feature.pl +++ b/virtual_feature.pl @@ -266,6 +266,11 @@ sub feature_setup # Update DANE DNS records &virtual_server::sync_domain_tlsa_records($d); +# Redirect HTTP to HTTPS +if ($tmpl->{'web_sslredirect'} || $d->{'auto_redirect'}) { + &virtual_server::create_redirect($d, &virtual_server::get_redirect_to_ssl($d)); + } + # Try to request a Let's Encrypt cert when enabling SSL post-creation for # the first time if (!$d->{'creating'} && $generated && $d->{'auto_letsencrypt'} &&