Fix: Tiles-Cache-Bust — versionierte PMTiles-URL + version-bewusstes Caching

'nur DACH auf Staging' Ursache: serve_tile schickte Cache-Control max-age=86400
OHNE Validator → Browser lieferte bis 24h die ALTEN PMTiles-Bytes (altes Directory)
trotz Datei-Swap. Fix:
- map-gl-style.js: tilesUrl() hängt ?v=TILES_VER an (Cache-Bust bei Tile-Deploy)
- serve_tile: ?v vorhanden → max-age=1y immutable; ohne → max-age=60 (self-heal) + ETag
- Makefile tiles-deploy zählt TILES_VER automatisch hoch + erinnert an Frontend-Deploy
This commit is contained in:
rene 2026-06-05 19:18:43 +02:00
parent 80b56c32ab
commit 2a809a9a0b
8 changed files with 33 additions and 18 deletions

View file

@ -185,6 +185,10 @@ tiles-deploy: check-ssh
@scp -O $(TILES_DIR)/dach.pmtiles $(DS_HOST):$(TILES_TARGET)/data/tiles/dach.pmtiles.tmp
@ssh $(DS_HOST) "mv -f $(TILES_TARGET)/data/tiles/dach.pmtiles.tmp $(TILES_TARGET)/data/tiles/dach.pmtiles"
@echo " ✓ dach.pmtiles ausgeliefert ($(if $(filter prod,$(ENV)),PRODUKTION,Staging))"
@# Cache-Bust: TILES_VER in map-gl-style.js hochzählen (sonst liefert der Browser bis 24h alte Tiles).
@NEWVER=$$(date +%Y%m%d%H%M); \
sed -i '' "s/var TILES_VER = '[0-9]*';/var TILES_VER = '$$NEWVER';/" backend/static/js/map-gl-style.js; \
echo " ↻ TILES_VER → $$NEWVER — JETZT Frontend ausliefern: make bump && make $(if $(filter prod,$(ENV)),deploy,staging)"
# ----------------------------------------------------------
# RELEASE — develop → main → Production (VERSION= pflichtangabe)