fix: dossiers-ngi Caddy explicit edition_dir map (cookie placeholder 404)

This commit is contained in:
Hernâni Marques 2026-09-30 16:00:55 +02:00
parent 10d445c712
commit a4ec0305bc
No known key found for this signature in database
2 changed files with 16 additions and 9 deletions

View file

@ -113,3 +113,6 @@ sudo ~/bin/caddy-apply
``` ```
Stanza SoT: `scripts/dossiers-ngi/caddy-dossiers-ngi.snippet`. Stanza SoT: `scripts/dossiers-ngi/caddy-dossiers-ngi.snippet`.
Caddy edition map must list each `editions/<slug>` explicitly. A map output of `{http.request.cookie.tdpd_edition}` did not expand on Caddy v2.11.4 (only `flask` worked → 404 for `main`/views). After new tips appear, refresh the snippet map (or regenerate from `ls editions`) before `apply-dossiers-ngi-edition-switch` + `caddy-apply`.

View file

@ -27,8 +27,7 @@
header Cache-Control "private, no-cache" header Cache-Control "private, no-cache"
file_server file_server
} }
# Path-root cascade stubs (feat-website-views, …) live under sites/…/cascade/ # Path-root cascade stubs live under sites/…/cascade/
# and must not fall through to editions/{cookie}/ (that yields 404).
handle /cascade/* { handle /cascade/* {
root * /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch root * /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch
header Cache-Control "private, no-cache" header Cache-Control "private, no-cache"
@ -41,14 +40,19 @@
file_server file_server
} }
# Dynamic editions: cookie value is the dir name under editions/ # Explicit edition_dir map (placeholder map output broke on Caddy v2.11.4 —
# (hourly builder stages every origin/* tip as slug with / → -). # non-flask cookies 404'd). Refresh this list when new origin tips appear
# Do not append a catch-all `~.* flask` — that forces unknown cookies # (branch-status rebuild creates editions/<slug>/).
# (and can mask missing edition dirs) onto the default freeze.
map {http.request.cookie.tdpd_edition} {edition_dir} { map {http.request.cookie.tdpd_edition} {edition_dir} {
default flask default flask
flask flask flask flask
~^[A-Za-z0-9_-]+$ {http.request.cookie.tdpd_edition} feat-sm-content feat-sm-content
feat-website-design feat-website-design
feat-website-features feat-website-features
feat-website-views feat-website-views
feature-nl-net-injestion-injestor-update feature-nl-net-injestion-injestor-update
main main
project_template project_template
} }
root * /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch/editions/{edition_dir} root * /var/www/monitoring-sites/dossiers.ngi.hacktivism.ch/editions/{edition_dir}