mirror of
https://github.com/sune-org/ORP.git
synced 2026-01-13 16:17:59 +00:00
origin filter
This commit is contained in:
2
index.js
2
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';
|
||||
|
||||
Reference in New Issue
Block a user