130 lines
2.6 KiB
Caddyfile
130 lines
2.6 KiB
Caddyfile
{
|
|
layer4 {
|
|
:22 {
|
|
route {
|
|
proxy {$GITEA_IP}:22
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
# Common: the wildcard cert.
|
|
(shared) {
|
|
tls /etc/caddy/tls/fullchain.pem /etc/caddy/tls/key.pem
|
|
}
|
|
|
|
# Only LAN (10/8) + Tailscale clients. Others get dropped.
|
|
(lan_only) {
|
|
import shared
|
|
@notlan not remote_ip 10.0.0.0/8 100.64.0.0/10
|
|
abort @notlan
|
|
}
|
|
|
|
# Open to anyone who can reach caddy.
|
|
(public_access) {
|
|
import shared
|
|
}
|
|
|
|
nvr.home.sosnovsky.ca {
|
|
import lan_only
|
|
reverse_proxy {$NVR_IP}:11080
|
|
}
|
|
|
|
jellyfin.home.sosnovsky.ca {
|
|
import public_access
|
|
reverse_proxy {$JELLYFIN_IP}:8096
|
|
}
|
|
|
|
castle.home.sosnovsky.ca {
|
|
import public_access
|
|
reverse_proxy castle.hub.internal
|
|
}
|
|
|
|
immich.home.sosnovsky.ca {
|
|
import lan_only
|
|
reverse_proxy {$IMMICH_IP}:2283
|
|
}
|
|
|
|
portainer.home.sosnovsky.ca {
|
|
import lan_only
|
|
reverse_proxy {$PORTAINER_IP}:9000
|
|
}
|
|
|
|
gitea.skyg.ca {
|
|
tls /etc/caddy/tls/gitea/fullchain.pem /etc/caddy/tls/gitea/key.pem
|
|
reverse_proxy {$GITEA_IP}:80
|
|
}
|
|
|
|
looprails.skyg.ca {
|
|
tls /etc/caddy/tls/gitea/fullchain.pem /etc/caddy/tls/gitea/key.pem
|
|
|
|
# Telemetry: only looprail's own requests reach Umami.
|
|
@telemetry {
|
|
method POST
|
|
path /t/v1
|
|
header Content-Type application/json*
|
|
header User-Agent looprail/*
|
|
header X-Looprail-Telemetry {$LOOPRAIL_TELEMETRY_KEY}
|
|
}
|
|
handle @telemetry {
|
|
request_body {
|
|
max_size 256KB
|
|
}
|
|
rewrite * /api/batch
|
|
reverse_proxy {$UMAMI_IP}:3000 {
|
|
# Umami never sees the sender's IP.
|
|
header_up -X-Forwarded-For
|
|
header_up -X-Real-IP
|
|
header_up -Forwarded
|
|
header_up -CF-Connecting-IP
|
|
header_up -True-Client-IP
|
|
header_up -X-Client-IP
|
|
header_up -X-Looprail-Telemetry
|
|
# One connection per request, so Umami's rate limit counts requests.
|
|
transport http {
|
|
keepalive off
|
|
}
|
|
}
|
|
}
|
|
handle /t/* {
|
|
respond 404
|
|
}
|
|
|
|
handle {
|
|
root * /srv/looprails
|
|
redir /looprail.html / permanent
|
|
file_server
|
|
}
|
|
}
|
|
|
|
# Umami dashboard for LoopRail telemetry, LAN only.
|
|
umami.home.sosnovsky.ca {
|
|
import lan_only
|
|
reverse_proxy {$UMAMI_IP}:3000
|
|
}
|
|
|
|
# Buzz: straight to its own caddy, LAN only.
|
|
buzz.home.sosnovsky.ca {
|
|
import lan_only
|
|
reverse_proxy https://{$BUZZ_IP}:443 {
|
|
header_up Host {http.request.host}
|
|
transport http {
|
|
tls
|
|
tls_server_name {http.request.host}
|
|
}
|
|
}
|
|
}
|
|
|
|
# Fallback: any other *.home.sosnovsky.ca host goes to the k8s Traefik.
|
|
# Host + SNI are preserved so Traefik routes on the original hostname.
|
|
*.home.sosnovsky.ca {
|
|
import lan_only
|
|
reverse_proxy https://{$K8S_INGRESS}:443 {
|
|
header_up Host {http.request.host}
|
|
transport http {
|
|
tls
|
|
tls_server_name {http.request.host}
|
|
}
|
|
}
|
|
}
|