added configurable modes to caddy http/https
This commit is contained in:
parent
c3989114b8
commit
43db707e34
3 changed files with 21 additions and 8 deletions
|
|
@ -10,3 +10,9 @@ STRIPE_CURRENCY=eur
|
||||||
# PocketBase superuser credentials (used by server-side basket/checkout/webhook APIs)
|
# PocketBase superuser credentials (used by server-side basket/checkout/webhook APIs)
|
||||||
POCKETBASE_ADMIN_EMAIL=admin@example.com
|
POCKETBASE_ADMIN_EMAIL=admin@example.com
|
||||||
POCKETBASE_ADMIN_PASSWORD=changeme
|
POCKETBASE_ADMIN_PASSWORD=changeme
|
||||||
|
|
||||||
|
# Caddy scheme for the reverse proxy on port 8080.
|
||||||
|
# http (default) — plain HTTP; matches the ORIGIN vars in docker-compose.yml
|
||||||
|
# https — HTTPS on :8080 (self-signed unless you add a cert issuer;
|
||||||
|
# also update ORIGIN/PUBLIC_* URLs to https://...)
|
||||||
|
CADDY_SCHEME=http
|
||||||
|
|
|
||||||
19
Caddyfile
19
Caddyfile
|
|
@ -1,23 +1,26 @@
|
||||||
# Reverse proxy — subdomain-based routing (plain HTTP on port 8080)
|
# Reverse proxy — subdomain-based routing on port 8080
|
||||||
# admin.{$DOMAIN} → app-admin (SvelteKit admin app)
|
# admin.{$DOMAIN} → app-admin (SvelteKit admin app)
|
||||||
# db.{$DOMAIN} → PocketBase (redirects / to /_/)
|
# db.{$DOMAIN} → PocketBase (redirects / to /_/)
|
||||||
# *.{$DOMAIN} → app-public (SvelteKit public app)
|
# *.{$DOMAIN} → app-public (SvelteKit public app)
|
||||||
#
|
#
|
||||||
# The `http://` prefix disables Caddy's automatic HTTPS so the site is served
|
# The scheme is controlled by the {$CADDY_SCHEME} env var (default: http).
|
||||||
# as plain HTTP on port 8080. This matches the ORIGIN env vars in
|
# - http → plain HTTP (disables Caddy's automatic HTTPS). Matches the ORIGIN
|
||||||
# docker-compose.yml (http://admin.${DOMAIN}:8080 etc.) so SvelteKit's CSRF
|
# env vars in docker-compose.yml (http://admin.${DOMAIN}:8080 etc.)
|
||||||
# protection accepts form POSTs.
|
# so SvelteKit's CSRF protection accepts form POSTs.
|
||||||
|
# - https → HTTPS. On a non-standard port (8080) Caddy will issue internal
|
||||||
|
# self-signed certificates unless you configure a real cert issuer.
|
||||||
|
# Remember to also update ORIGIN/PUBLIC_* URLs in docker-compose.yml.
|
||||||
|
|
||||||
http://admin.{$DOMAIN}:8080 {
|
{$CADDY_SCHEME}://admin.{$DOMAIN}:8080 {
|
||||||
reverse_proxy app-admin:3001
|
reverse_proxy app-admin:3001
|
||||||
}
|
}
|
||||||
|
|
||||||
http://db.{$DOMAIN}:8080 {
|
{$CADDY_SCHEME}://db.{$DOMAIN}:8080 {
|
||||||
# PocketBase admin UI lives at /_/ — redirect bare root there.
|
# PocketBase admin UI lives at /_/ — redirect bare root there.
|
||||||
redir / /_/{path}
|
redir / /_/{path}
|
||||||
reverse_proxy pocketbase:80
|
reverse_proxy pocketbase:80
|
||||||
}
|
}
|
||||||
|
|
||||||
http://www.{$DOMAIN}:8080, http://*.{$DOMAIN}:8080 {
|
{$CADDY_SCHEME}://www.{$DOMAIN}:8080, {$CADDY_SCHEME}://*.{$DOMAIN}:8080 {
|
||||||
reverse_proxy app-public:3000
|
reverse_proxy app-public:3000
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,10 @@ services:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
environment:
|
environment:
|
||||||
DOMAIN: ${DOMAIN:-localhost}
|
DOMAIN: ${DOMAIN:-localhost}
|
||||||
|
# Scheme used in Caddyfile site addresses. "http" = plain HTTP on :8080
|
||||||
|
# (matches the ORIGIN vars below). Switch to "https" only if you also
|
||||||
|
# update ORIGIN/PUBLIC_* URLs and provide a cert issuer.
|
||||||
|
CADDY_SCHEME: ${CADDY_SCHEME:-http}
|
||||||
volumes:
|
volumes:
|
||||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro,Z
|
- ./Caddyfile:/etc/caddy/Caddyfile:ro,Z
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue