Skip to content

Commit 72d8048

Browse files
fix: add CORS headers to CDN routes for cross-origin Pyodide access
Nightly docs at nightly.pywire.dev fetch wheels from pywire.dev/cdn/ (cross-origin). Without Access-Control-Allow-Origin, micropip in the Pyodide web worker gets opaque/blocked responses.
1 parent c9eaf98 commit 72d8048

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

worker/src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default {
2525
return new Response(
2626
`<!DOCTYPE html><html><head><title>Links for ${pkgName}</title></head>` +
2727
`<body><h1>Links for ${pkgName}</h1>\n${links}\n</body></html>`,
28-
{ headers: { 'Content-Type': 'text/html; charset=utf-8' } }
28+
{ headers: { 'Content-Type': 'text/html; charset=utf-8', 'Access-Control-Allow-Origin': '*' } }
2929
)
3030
}
3131

@@ -39,6 +39,7 @@ export default {
3939
headers: {
4040
'Content-Type': contentType,
4141
'Cache-Control': 'public, max-age=31536000, immutable',
42+
'Access-Control-Allow-Origin': '*',
4243
},
4344
})
4445
}

0 commit comments

Comments
 (0)