diff --git a/index.js b/index.js index 37ec9d7..d77f0fd 100644 --- a/index.js +++ b/index.js @@ -29,6 +29,8 @@ export default { if (method === 'OPTIONS') return new Response(null, { status: 204, headers: CORS_HEADERS }); + if ((h => h !== 'sune.planetrenox.com' && !h.endsWith('.github.io'))(new URL(req.headers.get('Origin') || 'null').hostname)) return withCORS(new Response('Forbidden', { status: 403 })); + if (url.pathname === '/ws') { const isGet = method === 'GET'; const isWs = req.headers.get('Upgrade') === 'websocket';