From 3f133f5e62884e43de351e6f6b60ca8d9606bbfa Mon Sep 17 00:00:00 2001
From: Johan Holtz <littlefox@lysator.liu.se>
Date: Sun, 2 Feb 2025 22:14:05 +0100
Subject: [PATCH] Revert "Merge branch 'master' into 'master'"

This reverts commit f074c84919c2a8938363f203676bddfa88e134ec, reversing
changes made to a82e147d3e0e5b97a3734579405ade5549e51163.

Causes 404 on main page. Needs looking into
---
 manifests/nginx.pp | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/manifests/nginx.pp b/manifests/nginx.pp
index cad7295..fbb75fe 100644
--- a/manifests/nginx.pp
+++ b/manifests/nginx.pp
@@ -134,17 +134,28 @@ class knuth::nginx {
     # }
   }
 
-  nginx::resource::location { '~ ^/~':
-    server  => 'www.lysator.liu.se',
-    ssl     => true,
-    proxy   => $target,
-    proxy_redirect => 'http://www.lysator.liu.se $scheme://www.lysator.liu.se',
+  $proxies = {
+    '/'        => 'http://localhost:8080', # Send to Roxen
+    '/foo/'    => 'http://gibraltar:8081',
+  }
+
+  $proxies.each |$location, $target| {
+    nginx::resource::location{ $location:
+      server         => 'www.lysator.liu.se',
+      ssl            => true,
+      proxy          => $target,
+      # Roxen generates http headers when redirecting, since we work
+      # unencrypted internally. It does however answer with
+      # www.lysator.liu.se (first instance). Second instance of
+      # www.lysator.liu.se is our external server name.
+      proxy_redirect => 'http://www.lysator.liu.se $scheme://www.lysator.liu.se',
+    }
   }
 
-  nginx::resource::location { '/':
+  nginx::resource::location { '/static-test':
     server  => 'www.lysator.liu.se',
     ssl     => true,
-    alias   => '/srv/www/static',
+    www_root => '/srv/www/static',
   }
 
   # Not really neeed, but peoples automatic scanners complain, and
-- 
GitLab