]> xn--ix-yja.es Git - alex.git/commitdiff
Allow http hosts and detect https automatically
authoralex <alex@pdp7.net>
Tue, 29 Aug 2023 18:47:16 +0000 (18:47 +0000)
committeralex <alex@pdp7.net>
Tue, 29 Aug 2023 18:48:20 +0000 (18:48 +0000)
personal_infra/puppet/modules/proxmox/manifests/proxy_host.pp

index 658d4f4ef5088c8b7abfa038fa5ecc89e9ecce32..ab0cd69a635233d0a99e09997a983affcb920a9f 100644 (file)
@@ -1,17 +1,26 @@
 define proxmox::proxy_host (String[1] $target, Optional[String[1]] $overwrite_rh_certs = undef) {
+  if $target =~ /^https:/ {
+    $ssl_fragment = @("EOT")
+      SSLEngine on
+      SSLProxyEngine on
+      SSLProxyCheckPeerName off
+    | EOT
+  }
+  else {
+    $ssl_fragment = ""
+  }
+
   file {"/etc/apache2/sites-enabled/$title.conf":
     content => @("EOT")
       MDomain $title
 
       <VirtualHost *:443>
         ServerName $title
-        SSLEngine on
 
         ProxyPass "/" "$target"
         ProxyPassReverse "/" "$target"
         ProxyPreservehost On
-        SSLProxyEngine on
-        SSLProxyCheckPeerName off
+        $ssl_fragment
       </VirtualHost>
       | EOT
     ,