From 025febc17fdf87cb4af7e85e06b16656b6f70652 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Sat, 29 Aug 2026 11:56:40 -0400 Subject: [PATCH] fix(nginx): keep cross-origin isolation when a player URL carries a query $request_uri includes the query string, so the end-anchored player pattern missed /rom//jsdos?x=1 and nginx dropped COOP and COEP, leaving the threaded runtime without SharedArrayBuffer. Accept an optional query instead of anchoring at the path end. Matching stays on $request_uri: try_files rewrites $uri to /index.html before add_header runs, so a $uri map would match no player URL at all. Co-Authored-By: Claude Opus 5 (1M context) --- docker/nginx/templates/default.conf.template | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker/nginx/templates/default.conf.template b/docker/nginx/templates/default.conf.template index 2944a1e6b..e7f5320e6 100644 --- a/docker/nginx/templates/default.conf.template +++ b/docker/nginx/templates/default.conf.template @@ -16,15 +16,16 @@ map $http_x_forwarded_proto $forwardscheme { # COEP and COOP headers for cross-origin isolation, which are set only for the # EmulatorJS and js-dos player paths, to enable SharedArrayBuffer support, which -# is needed for multi-threaded cores. +# is needed for multi-threaded cores. Not $uri: try_files rewrites it to +# /index.html before add_header runs, so the query string is matched explicitly. map $request_uri $coep_header { default ""; - ~^/rom/.*/(ejs|jsdos)$ "require-corp"; + ~^/rom/.*/(ejs|jsdos)(\?|$) "require-corp"; ~^/console/rom/[0-9]+/play "require-corp"; } map $request_uri $coop_header { default ""; - ~^/rom/.*/(ejs|jsdos)$ "same-origin"; + ~^/rom/.*/(ejs|jsdos)(\?|$) "same-origin"; ~^/console/rom/[0-9]+/play "same-origin"; }