# ---------------------------------------------------------------------------- # OPTIONAL: appended to the deployed Caddyfile by deploy.sh when BASE_DOMAIN is # set. Serves /.well-known/webfinger at the base domain (so Tailscale et al. # can discover the OIDC issuer) and redirects everything else to $REDIRECT_URL. # Needs BASE_DOMAIN + REDIRECT_URL in .env (passed to caddy via compose). # ---------------------------------------------------------------------------- {$BASE_DOMAIN} { encode zstd gzip @webfinger path /.well-known/webfinger handle @webfinger { header Content-Type "application/jrd+json" header Cache-Control "public, max-age=3600" templates respond `{ "subject": "{{.Req.URL.Query.Get "resource"}}", "links": [ { "rel": "http://openid.net/specs/connect/1.0/issuer", "href": "https://{$POCKETID_DOMAIN}" } ] }` 200 } handle { redir {$REDIRECT_URL}{uri} permanent } header { Strict-Transport-Security "max-age=31536000; includeSubDomains" X-Content-Type-Options "nosniff" Referrer-Policy "strict-origin-when-cross-origin" -Server } log { output stdout format console } }