From fdc6d8f14da6d28dd364b6f9872269e16f18c8e3 Mon Sep 17 00:00:00 2001 From: achraf Date: Mon, 8 Jun 2026 00:34:28 +0200 Subject: [PATCH] Serve ONNX modules with JavaScript MIME type --- nginx.conf | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nginx.conf b/nginx.conf index 8537017..bb1fba0 100644 --- a/nginx.conf +++ b/nginx.conf @@ -27,6 +27,19 @@ server { image/svg+xml font/woff2; + # 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. + location ~* ^/assets/.*\.mjs$ { + try_files $uri =404; + default_type application/javascript; + expires 1y; + add_header Cache-Control "public, immutable"; + 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; + } + location /assets/ { try_files $uri =404; expires 1y;