# Shared nginx server config for all Angular SPA containers. # # Five per-app copies of this file exist (b2g/, gMarket/, b2g_website/, # b2g_filems_fe/ and nibe_datamanager/nibedatamanager_fe/ under docker/) because each SPA # Dockerfile COPYs it from its own build context. Keep them identical to this one - the root # copy is what Docker Compose bind-mounts locally, the per-app copies ship in the images. server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Liveness/readiness probe for ALB target groups and ECS container health checks. # Exact-match location, so it outranks the prefix and regex blocks below and never # touches the filesystem. location = /healthz { access_log off; return 200 "ok "; } # SPA fallback — deep links resolve to index.html location / { try_files $uri $uri/ /index.html; } # assets/env.js is REGENERATED AT CONTAINER START by docker/spa-entrypoint.sh and # holds the per-environment config (MICROFE_HOST). Unlike every other .js here it has # a stable, unhashed filename, so the 7d rule below would pin one environment's config # in the browser for a week - which is exactly what happened: browsers kept replaying a # stale microfeHost and loaded the menu micro-frontend from the old demo host long after # the value had been corrected server-side. # # Exact-match location, so it outranks the regex block below (nginx tries "=" first). # "expires off" stops nginx emitting its own Expires/Cache-Control, so this block # sends exactly one Cache-Control header rather than two competing ones. location = /assets/env.js { add_header Cache-Control "no-store, no-cache, must-revalidate" always; expires off; try_files $uri =404; } # Cache immutable build artifacts. Safe because Angular content-hashes these # filenames (main-FOXAUEPV.js) - a new build produces a new name. location ~* \.(js|css|woff2?|ttf|svg|png|jpg|jpeg|gif|ico)$ { expires 7d; add_header Cache-Control "public"; try_files $uri =404; } }