-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
19 lines (17 loc) · 952 Bytes
/
Copy pathserver.js
File metadata and controls
19 lines (17 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import http from 'node:http';
import { handler } from './build/handler.js';
// Vivari needs SharedArrayBuffer, so every response has to be cross-origin isolated - not
// just the documents a SvelteKit hook would see. adapter-node serves build/client through sirv
// before the SvelteKit handler runs, and a dedicated worker script served without COEP is
// blocked outright (ERR_BLOCKED_BY_RESPONSE) when the page that spawns it is isolated,
// which is exactly how the kernel worker is loaded. CORP is open so another site can frame
// the app
const port = Number(process.env.PORT ?? 3000);
http
.createServer((request, response) => {
response.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
response.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
response.setHeader('Cross-Origin-Resource-Policy', 'cross-origin');
handler(request, response);
})
.listen(port, () => console.log(`Glass Garden listening on ${port}`));