Files
caddy-conf/Caddyfile
dtoro a52cf68d0f photos: wrap site block in route{} to force literal directive order
Without an explicit route{} block, caddy auto-hoists `redir` ahead of
`reverse_proxy`. That meant /library/* still redirected to / even
though I'd placed an @pp_login reverse_proxy above the redirs in the
file. Wrap the whole site in route{} so directives run in source order
and the more-specific /library/login matcher wins before the broader
/library/* redir.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 01:02:11 +02:00

234 lines
5.4 KiB
Caddyfile

# Authentik forward-auth snippet (domain-level mode).
# Usage: add "import authentik" inside any site block to gate it.
(authentik) {
route {
reverse_proxy /outpost.goauthentik.io/* http://192.168.8.180:9000
forward_auth http://192.168.8.180:9000 {
uri /outpost.goauthentik.io/auth/caddy
copy_headers X-Authentik-Username X-Authentik-Groups X-Authentik-Email X-Authentik-Name X-Authentik-Uid X-Authentik-Jwt X-Authentik-Meta-Jwks X-Authentik-Meta-Outpost X-Authentik-Meta-Provider X-Authentik-Meta-App X-Authentik-Meta-Version
trusted_proxies private_ranges
header_up X-Forwarded-Host {host}
header_up X-Forwarded-Proto {scheme}
header_up X-Forwarded-Uri {uri}
}
}
}
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.
media.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.206:8096
}
git.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
handle_path /_plantuml/* {
rewrite * /plantuml{uri}
reverse_proxy 192.168.8.205:8079
}
handle {
reverse_proxy 192.168.8.121:3000
}
}
paperless.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
@api path /api/*
handle @api {
reverse_proxy 192.168.8.130:8000
}
handle {
import authentik
reverse_proxy 192.168.8.130:8000
}
}
books.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.205:6060
}
home.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.101:8123
}
cloud.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.224:80
}
matrix.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.239:8008
}
proxmox.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy https://192.168.8.77:8006 {
transport http {
tls_insecure_skip_verify
}
}
}
docker.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy https://192.168.8.205:9443 {
transport http {
tls_insecure_skip_verify
}
}
}
jellyseerr.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.132:5056
}
qbit.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
@api path /api/*
handle @api {
reverse_proxy 192.168.8.132:8080
}
handle {
import authentik
reverse_proxy 192.168.8.132:8080
}
}
sab.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.132:8081
}
blog.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.205:8080
}
photos.hubris.network {
# mule-image — PhotoPrism + Go sidecar + SvelteKit (post-Mulimage 2.0)
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
encode zstd gzip
# Wrap everything in `route` so directives run in literal source
# order. Without it caddy hoists `redir` above `reverse_proxy`,
# and the /library/* redir eats /library/login before PhotoPrism
# ever sees it (OIDC initiation dies).
route {
# PhotoPrism API + OIDC callback (callback path /api/v1/oidc/redirect)
@pp path /api/v1/* /api/v1 /static/* /share/*
reverse_proxy @pp 192.168.8.136:2342
# PhotoPrism's OIDC initiation surface — must reach PhotoPrism,
# not be bounced back to the SPA.
@pp_login path /library/login /library/login/*
reverse_proxy @pp_login 192.168.8.136:2342
# Everything else under /library/* (notably /library/browse,
# PhotoPrism's post-login destination) bounces back to the
# SvelteKit SPA — mule-image is the only user-facing frontend.
redir /library / 302
redir /library/* / 302
# mule-sidecar (Go) — keeps the /api/sidecar/ prefix
@sc path /api/sidecar/*
reverse_proxy @sc 192.168.8.136:8000
# Catch-all → nginx-on-120 serving the SvelteKit static bundle
reverse_proxy 192.168.8.136:3000
}
}
auth.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.180:9000
}
artifacto.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
# Public paths: share URLs, static assets, health — no SSO
@public path /p/* /static/* /healthz
handle @public {
reverse_proxy 192.168.8.205:3100
}
# Admin + login surface: Authentik forward-auth + shared-secret header
# so the app can auto-login an Authentik-authenticated user.
handle {
import authentik
reverse_proxy 192.168.8.205:3100 {
header_up X-Artifacto-Gateway {env.ARTIFACTO_GATEWAY_SECRET}
}
}
}
plato.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.190:8080
}
zimaos.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.195
}
# Homelab MCP server (read-only context + management tools).
# Mesh+LAN-gated by the service itself + nftables; no SSO so agent clients work.
mcp.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.205:9810
}
# Per-client age-key issuance (mesh-only via source-IP gating in the service).
# No SSO — agents call this during bootstrap; identity is mesh peer + hostname.
secrets.hubris.network {
tls {
dns ionos {env.IONOS_AUTH_API_TOKEN}
}
reverse_proxy 192.168.8.205:9820
}