aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2023-09-09 17:40:35 +0200
committerWojtek Kosior <koszko@koszko.org>2023-09-09 17:40:35 +0200
commitd43ba46b1cdbc40b562cbc8d149b813f91a16b66 (patch)
tree425658951447d67c2972bd43922d4309467dd001
parent26c06d07e2d201c0c7f02eee10038b8d9d5dda64 (diff)
downloadkoszko-org-server-d43ba46b1cdbc40b562cbc8d149b813f91a16b66.tar.gz
koszko-org-server-d43ba46b1cdbc40b562cbc8d149b813f91a16b66.zip
Redirect HTTP sites to HTTPS
-rw-r--r--container.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/container.scm b/container.scm
index ef97dc1..2cab0f4 100644
--- a/container.scm
+++ b/container.scm
@@ -114,6 +114,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
'Alias "/.well-known/acme-challenge" "/srv/http/acme-challenge/")