From d43ba46b1cdbc40b562cbc8d149b813f91a16b66 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Sat, 9 Sep 2023 17:40:35 +0200 Subject: Redirect HTTP sites to HTTPS --- container.scm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/container.scm b/container.scm index ef97dc1..2cab0f4 100644 --- a/container.scm +++ b/container.scm @@ -113,6 +113,14 @@ '()) ,(httpd-directive 'ServerAdmin "koszko@koszko.org") ,(httpd-tag 'If (list (format #f "%{HTTP_HOST} != '~a'" name)) + (httpd-directive 'Redirect 'permanent "/" + (format #f "http~a://~a/" + (if tls? "s" "") name))) + ,(httpd-tag 'ElseIf + (list (format #f "~a && (~a !~~ ~a)" + (if tls? "false" "true") + "%{REQUEST_URI}" + "m#^/[.]well-known/acme-challenge/.*#")) (httpd-directive 'Redirect 'permanent "/" (format #f "https://~a/" name))) ,(httpd-directive -- cgit v1.2.3