Add hocuspocus.

This commit is contained in:
ba1ash
2025-10-12 22:04:00 +02:00
parent 6831d93c1b
commit 0944595b5a
4 changed files with 29 additions and 8 deletions

View File

@@ -1,12 +1,18 @@
:80 {
reverse_proxy * http://${APP_HOST}:8080 {
# The following directives are needed to make the proxy forward explicitly the X-Forwarded-* headers. If unset,
# Caddy will reset them. See: https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#defaults
# This is needed, if you are using a reverse proxy in front of the compose stack and Caddy is NOT your first
# point of contact.
# When using Caddy is reachable as a first point of contact, it is highly recommended to configure the server's
# global `trusted_proxies` directive. See: https://caddyserver.com/docs/caddyfile/options#trusted-proxies
# Reverse proxy for WebSocket connections
@hocuspocus {
path /hocuspocus*
}
reverse_proxy @hocuspocus ${HOCUSPOCUS_HOST}:1234 {
header_up X-Forwarded-Proto {header.X-Forwarded-Proto}
header_up X-Forwarded-For {header.X-Forwarded-For}
}
# Reverse proxy for all other HTTP requests
@app {
not path /hocuspocus*
}
reverse_proxy @app ${APP_HOST}:8080 {
header_up X-Forwarded-Proto {header.X-Forwarded-Proto}
header_up X-Forwarded-For {header.X-Forwarded-For}
}

View File

@@ -3,6 +3,9 @@ FROM caddy:2
COPY ./Caddyfile.template /etc/caddy/Caddyfile.template
ARG APP_HOST
RUN sed 's|${APP_HOST}|'"$APP_HOST"'|g' /etc/caddy/Caddyfile.template > /etc/caddy/Caddyfile
ARG HOCUSPOCUS_HOST
RUN sed -e 's|${APP_HOST}|'"$APP_HOST"'|g' \
-e 's|${HOCUSPOCUS_HOST}|'"$HOCUSPOCUS_HOST"'|g' \
/etc/caddy/Caddyfile.template > /etc/caddy/Caddyfile
ENTRYPOINT ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]