diff --git a/Containers/apache/Caddyfile b/Containers/apache/Caddyfile index 6c815c8b..6006fee4 100644 --- a/Containers/apache/Caddyfile +++ b/Containers/apache/Caddyfile @@ -16,12 +16,49 @@ {$PROTOCOL}://{$NC_DOMAIN}:{$APACHE_PORT} { - # Bundled - import /caddy-imports/* + # Collabora + route /browser/* { + reverse_proxy {$COLLABORA_HOST}:9980 + } + route /hosting/* { + reverse_proxy {$COLLABORA_HOST}:9980 + } + route /cool/* { + reverse_proxy {$COLLABORA_HOST}:9980 + } + + # Notify Push + route /push/* { + uri strip_prefix /push + reverse_proxy {$NEXTCLOUD_HOST}:7867 + } + + # 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 + } + } + + # Talk + route /standalone-signaling/* { + uri strip_prefix /standalone-signaling + reverse_proxy {$TALK_HOST}:8081 + } # 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 + } + # TLS options tls { issuer acme { diff --git a/Containers/apache/Dockerfile b/Containers/apache/Dockerfile index f9cea6f1..c96e5470 100644 --- a/Containers/apache/Dockerfile +++ b/Containers/apache/Dockerfile @@ -7,8 +7,6 @@ COPY --from=caddy /usr/bin/caddy /usr/bin/caddy COPY --chown=33:33 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 deleted file mode 100644 index 89d44bae..00000000 --- a/Containers/apache/caddy-imports/collabora +++ /dev/null @@ -1,10 +0,0 @@ -# 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 deleted file mode 100644 index 6aaf6d6a..00000000 --- a/Containers/apache/caddy-imports/notify-push +++ /dev/null @@ -1,5 +0,0 @@ -# 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 deleted file mode 100644 index e1994139..00000000 --- a/Containers/apache/caddy-imports/onlyoffice +++ /dev/null @@ -1,8 +0,0 @@ -# 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 deleted file mode 100644 index b7024cde..00000000 --- a/Containers/apache/caddy-imports/talk +++ /dev/null @@ -1,5 +0,0 @@ -# Talk -route /standalone-signaling/* { - uri strip_prefix /standalone-signaling - reverse_proxy {$TALK_HOST}:8081 -} diff --git a/Containers/apache/nextcloud b/Containers/apache/nextcloud deleted file mode 100644 index a0c2c80a..00000000 --- a/Containers/apache/nextcloud +++ /dev/null @@ -1,7 +0,0 @@ -# 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 ccd1ca52..1806f7b4 100644 --- a/Containers/apache/start.sh +++ b/Containers/apache/start.sh @@ -39,15 +39,12 @@ echo "$CADDYFILE" > /Caddyfile # Change the trusted_proxies in case of reverse proxies if [ "$APACHE_PORT" != '443' ]; then - CADDYFILE="$(sed 's|# trusted_proxies placeholder|trusted_proxies private_ranges|' /Caddyfile)" + CADDYFILE="$(sed 's|# trusted_proxies placeholder|trusted_proxies static private_ranges|' /Caddyfile)" else - CADDYFILE="$(sed 's|trusted_proxies private_ranges|# trusted_proxies placeholder|' /Caddyfile)" + CADDYFILE="$(sed 's|trusted_proxies.*private_ranges|# trusted_proxies placeholder|' /Caddyfile)" fi echo "$CADDYFILE" > /Caddyfile -# Overwrite nextcloud conf -cat /nextcloud > /mnt/data/caddy-imports/nextcloud - # Fix the Caddyfile format caddy fmt --overwrite /Caddyfile @@ -57,6 +54,12 @@ mkdir -p /mnt/data/caddy/ # Add caddy import path mkdir -p /mnt/data/caddy-imports +# Remove falsely added Nextcloud conf +rm -f /mnt/data/caddy-imports/nextcloud + +# Makre sure that the caddy-imports dir is not empty +echo "" > /mnt/data/caddy-imports/empty + # Fix apache startup rm -f /usr/local/apache2/logs/httpd.pid