diff --git a/Containers/apache/Caddyfile b/Containers/apache/Caddyfile index ce195ff3..7343a3c3 100644 --- a/Containers/apache/Caddyfile +++ b/Containers/apache/Caddyfile @@ -5,6 +5,10 @@ root /mnt/data/caddy } + servers { + # trusted_proxies placeholder + } + log { level ERROR } @@ -12,59 +16,14 @@ {$PROTOCOL}://{$NC_DOMAIN}:{$APACHE_PORT} { - # Notify Push - route /push/* { - uri strip_prefix /push - reverse_proxy {$NEXTCLOUD_HOST}:7867 { - # trusted_proxies placeholder - } - } + # Bundled + import /caddy-imports/* - # Talk - route /standalone-signaling/* { - uri strip_prefix /standalone-signaling - reverse_proxy {$TALK_HOST}:8081 { - # trusted_proxies placeholder - } - } - - # Collabora - route /browser/* { - reverse_proxy {$COLLABORA_HOST}:9980 { - # trusted_proxies placeholder - } - } - route /hosting/* { - reverse_proxy {$COLLABORA_HOST}:9980 { - # trusted_proxies placeholder - } - } - route /cool/* { - reverse_proxy {$COLLABORA_HOST}:9980 { - # trusted_proxies placeholder - } - } - - # Onlyoffice - route /onlyoffice/* { - uri strip_prefix /onlyoffice - reverse_proxy {$ONLYOFFICE_HOST}:80 { - header_up X-Forwarded-Host {http.request.host}/onlyoffice - header_up X-Forwarded-Proto https - # trusted_proxies placeholder - } - } + # Others + import /mnt/data/caddy-imports/* # Nextcloud - route { - rewrite /.well-known/carddav /remote.php/dav - rewrite /.well-known/caldav /remote.php/dav - header Strict-Transport-Security max-age=31536000; - reverse_proxy localhost:8000 { - # See https://github.com/nextcloud/all-in-one/issues/828 - # trusted_proxies placeholder - } - } + import /mnt/data/nextcloud # TLS options tls { diff --git a/Containers/apache/Dockerfile b/Containers/apache/Dockerfile index 7a95ff06..f1443d09 100644 --- a/Containers/apache/Dockerfile +++ b/Containers/apache/Dockerfile @@ -7,7 +7,8 @@ COPY --from=caddy /usr/bin/caddy /usr/bin/caddy COPY --chown=www-data:www-data Caddyfile /Caddyfile COPY --chmod=664 nextcloud.conf /usr/local/apache2/conf/nextcloud.conf - +COPY --chmod=664 nextcloud /nextcloud +COPY --chmod=664 caddy-imports/* /caddy-imports/ COPY --chmod=664 supervisord.conf /supervisord.conf COPY --chmod=775 start.sh /start.sh COPY --chmod=775 healthcheck.sh /healthcheck.sh diff --git a/Containers/apache/caddy-imports/collabora b/Containers/apache/caddy-imports/collabora new file mode 100644 index 00000000..89d44bae --- /dev/null +++ b/Containers/apache/caddy-imports/collabora @@ -0,0 +1,10 @@ +# Collabora +route /browser/* { + reverse_proxy {$COLLABORA_HOST}:9980 +} +route /hosting/* { + reverse_proxy {$COLLABORA_HOST}:9980 +} +route /cool/* { + reverse_proxy {$COLLABORA_HOST}:9980 +} diff --git a/Containers/apache/caddy-imports/notify-push b/Containers/apache/caddy-imports/notify-push new file mode 100644 index 00000000..6aaf6d6a --- /dev/null +++ b/Containers/apache/caddy-imports/notify-push @@ -0,0 +1,5 @@ +# Notify Push +route /push/* { + uri strip_prefix /push + reverse_proxy {$NEXTCLOUD_HOST}:7867 +} diff --git a/Containers/apache/caddy-imports/onlyoffice b/Containers/apache/caddy-imports/onlyoffice new file mode 100644 index 00000000..e1994139 --- /dev/null +++ b/Containers/apache/caddy-imports/onlyoffice @@ -0,0 +1,8 @@ +# Onlyoffice +route /onlyoffice/* { + uri strip_prefix /onlyoffice + reverse_proxy {$ONLYOFFICE_HOST}:80 { + header_up X-Forwarded-Host {http.request.host}/onlyoffice + header_up X-Forwarded-Proto https + } +} diff --git a/Containers/apache/caddy-imports/talk b/Containers/apache/caddy-imports/talk new file mode 100644 index 00000000..79d2a41a --- /dev/null +++ b/Containers/apache/caddy-imports/talk @@ -0,0 +1,5 @@ +# Talk +route /standalone-signaling/* { + uri strip_prefix /standalone-signaling + reverse_proxy {$TALK_HOST}:8081 +} \ No newline at end of file diff --git a/Containers/apache/nextcloud b/Containers/apache/nextcloud new file mode 100644 index 00000000..16a7a088 --- /dev/null +++ b/Containers/apache/nextcloud @@ -0,0 +1,7 @@ +# Nextcloud +route { + rewrite /.well-known/carddav /remote.php/dav + rewrite /.well-known/caldav /remote.php/dav + header Strict-Transport-Security max-age=31536000; + reverse_proxy localhost:8000 +} diff --git a/Containers/apache/start.sh b/Containers/apache/start.sh index c466d907..6229f025 100644 --- a/Containers/apache/start.sh +++ b/Containers/apache/start.sh @@ -45,6 +45,9 @@ else fi echo "$CADDYFILE" > /Caddyfile +# Overwrite nextcloud conf +cat /nextcloud > /mnt/data/nextcloud + # Fix the Caddyfile format caddy fmt --overwrite /Caddyfile