Files
lucioandClaude Opus 5.5 e48a1eacf4 Keep hotlink 403s out of CDN and browser caches
The tile hotlink refusal is sent with Cache-Control: no-store from
LuPhoto, Caddy and nginx instead of inheriting the one-year immutable
header. cloudflare.md explains that edge-cached tiles bypass the
origin Referer check, recommends a WAF rule for /t/, and notes that
tile URLs depend only on the photo, the settings and the site key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 22:49:45 -08:00

52 lines
1.0 KiB
Caddyfile

photos.luciochen.com {
root * /var/lib/luphoto/site/current
@hotlink {
path /t/*
header Referer *
not header_regexp Referer ^https?://photos\.luciochen\.com(:[0-9]+)?(/|$)
}
handle @hotlink {
header Cache-Control "no-store"
respond 403
}
@hidden path */.* *.gz
error @hidden 404
@immutable path /t/* /og/* /assets/*
header @immutable Cache-Control "public, max-age=31536000, immutable"
@short not path /t/* /og/* /assets/* /k
header @short Cache-Control "public, max-age=60"
header {
Content-Security-Policy "default-src 'self'; img-src 'self' blob: data:; font-src 'self'; worker-src 'self'; frame-ancestors 'none'"
X-Content-Type-Options nosniff
Referrer-Policy strict-origin-when-cross-origin
-Server
}
handle /k {
reverse_proxy 127.0.0.1:8080
}
@methods {
not method GET HEAD
not path /k
}
respond @methods 405
file_server {
precompressed gzip
}
handle_errors {
@notfound expression {err.status_code} == 404
rewrite @notfound /404.html
file_server {
precompressed gzip
}
}
}