mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 02:22:44 +01:00
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/<id>/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) <noreply@anthropic.com>
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user