docker/web/Caddyfile
changeset 0 2a447b707b65
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docker/web/Caddyfile	Wed Sep 04 16:52:49 2024 +0200
@@ -0,0 +1,48 @@
+(cors) {
+        @cors_preflight{args.0} method OPTIONS
+        @cors{args.0} header Origin {args.0}
+
+        handle @cors_preflight{args.0} {
+                header {
+                        Access-Control-Allow-Origin "{args.0}"
+                        Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS"
+                        Access-Control-Allow-Headers *
+                        Access-Control-Max-Age "3600"
+                        defer
+                }
+                respond "" 204
+        }
+
+        handle @cors{args.0} {
+                header {
+                        Access-Control-Allow-Origin "{args.0}"
+                        Access-Control-Expose-Headers *
+                        defer
+                }
+        }
+}
+
+ldt.iri.centrepompidou.fr {
+    tls internal
+
+    redir / /ldtplatform/
+    rewrite /ldtplatform /ldtplatform/
+    redir /ldt /ldtplatform/ldt/
+    redir /ldt/ /ldtplatform/ldt/
+
+    handle_path /static/* {
+        root * /static
+        file_server
+        import cors *
+    }
+    
+    handle_path /ldtplatform/* {
+        reverse_proxy server:8000 {
+            transport uwsgi {
+                uwsgi_param SCRIPT_NAME /ldtplatform
+                uwsgi_param UWSGI_SCHEME https
+            }
+        }
+        import cors *
+    }
+}
\ No newline at end of file