diff --git a/nginx.conf b/nginx.conf index bb1fba0..539e932 100644 --- a/nginx.conf +++ b/nginx.conf @@ -27,6 +27,17 @@ server { image/svg+xml font/woff2; + # Worker response headers are security-sensitive. Revalidate worker scripts + # so a corrected COOP/COEP configuration is not hidden by a year-long cache. + location ~* ^/assets/worker-[^/]+\.js$ { + try_files $uri =404; + expires -1; + add_header Cache-Control "no-cache, max-age=0, must-revalidate"; + add_header Cross-Origin-Opener-Policy "same-origin" always; + add_header Cross-Origin-Embedder-Policy "require-corp" always; + add_header Cross-Origin-Resource-Policy "same-origin" always; + } + # nginx's bundled MIME map does not consistently include .mjs. ONNX Runtime # loads these files as JavaScript modules, which browsers reject when served # as application/octet-stream. diff --git a/src/tools/background-remover/worker.ts b/src/tools/background-remover/worker.ts index e2ef63d..6e56889 100644 --- a/src/tools/background-remover/worker.ts +++ b/src/tools/background-remover/worker.ts @@ -15,7 +15,7 @@ self.addEventListener( const files = input.files; if (!files || !Array.isArray(files) || files.length === 0) { - post({ type: "error", id, error: "No image provided." }); + post({ type: "error", id, error: "No image file provided." }); return; }