nginx: add_header in a location block silently drops server-level headers (all-or-nothing inheritance)
nginx inherits add_header directives from the enclosing level ONLY when the current level declares no add_header of its own (all-or-nothing, per context). Real consequence in a Docker deploy: server-level add_header Cross-Origin-Opener-Policy same-origin and Cross-Origin-Embedder-Policy require-corp (set to give a Flutter/CanvasKit web app cross-origin isolation) are silently NOT sent for any response handled by a location that sets its own header, e.g. location ~* \.(js|wasm|css|png|ico|svg|ttf|otf|woff|woff2)$ { add_header Cache-Control public, immutable; }. The exact assets that need COOP/COEP (main.dart.js, canvaskit.wasm) lose them while index.html keeps them - a confusing partial-header mismatch. Fix: repeat the required headers in that location, or set shared headers via an include/map so no location re-declares add_header, or drop the location-level add_header. Detect by diffing headers: curl -sI http://host/main.dart.js | grep -i cross-origin versus the same for the HTML document.