61 lines
2.1 KiB
Text
61 lines
2.1 KiB
Text
# Stanza body for dossiers.ngi.hacktivism.ch only (hand-check / re-seed).
|
|
# Apply on koopa (host-local):
|
|
# bash ~/bin/apply-dossiers-ngi-edition-switch.sh
|
|
# sudo ~/bin/caddy-apply
|
|
#
|
|
# Sticky bar switches build via cookie tdpd_edition → editions/<name>/.
|
|
# Stock Caddy only (templates + map + handle). No replace-response plugin.
|
|
# Keep .2 / .3 blocks untouched.
|
|
#
|
|
# Site-block body (no outer braces):
|
|
|
|
header Alt-Svc "clear"
|
|
# Cookie selects editions/<slug>/; same paths (/static/css/style.css) must not
|
|
# share one browser/CDN cache entry across editions (main has no green CSS).
|
|
header Vary "Cookie"
|
|
header Cache-Control "private, no-cache"
|
|
|
|
@use path_regexp use ^/_cascade/use/([A-Za-z0-9_-]+)/?$
|
|
handle @use {
|
|
header Set-Cookie "tdpd_edition={re.use.1}; Path=/; Max-Age=31536000; SameSite=Lax"
|
|
header Cache-Control "private, no-store"
|
|
redir * / 302
|
|
}
|
|
|
|
handle /_cascade/* {
|
|
root * /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch
|
|
header Cache-Control "private, no-cache"
|
|
file_server
|
|
}
|
|
# Path-root cascade stubs (feat-website-views, …) live under sites/…/cascade/
|
|
# and must not fall through to editions/{cookie}/ (that yields 404).
|
|
handle /cascade/* {
|
|
root * /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch
|
|
header Cache-Control "private, no-cache"
|
|
file_server
|
|
try_files {path} {path}/ {path}/index.html
|
|
}
|
|
handle /branch-status.json {
|
|
root * /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch
|
|
header Cache-Control "private, no-cache"
|
|
file_server
|
|
}
|
|
|
|
# Dynamic editions: cookie value is the dir name under editions/
|
|
# (hourly builder stages every origin/* tip as slug with / → -).
|
|
# Do not append a catch-all `~.* flask` — that forces unknown cookies
|
|
# (and can mask missing edition dirs) onto the default freeze.
|
|
map {http.request.cookie.tdpd_edition} {edition_dir} {
|
|
default flask
|
|
flask flask
|
|
~^[A-Za-z0-9_-]+$ {http.request.cookie.tdpd_edition}
|
|
}
|
|
|
|
root * /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch/editions/{edition_dir}
|
|
templates {
|
|
mime text/html
|
|
between "{%" "%}"
|
|
root /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch
|
|
}
|
|
file_server
|
|
try_files {path} {path}/ {path}/index.html
|