From cae88bdcd56fbca2a2158627ffe381212b6a1d30 Mon Sep 17 00:00:00 2001 From: ben lang <9093983+bl3rune@users.noreply.github.com> Date: Mon, 6 May 2024 20:08:26 +0100 Subject: [PATCH] Add CORS headers --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 4aa033e..9bd5769 100644 --- a/src/index.ts +++ b/src/index.ts @@ -28,7 +28,8 @@ if (process.env.HTTP_ENABLED) { const host = rawGameUrl[0]; const gameString = rawGameUrl[1]; const port = rawGameUrl[2] ? parseInt(rawGameUrl[2]) : undefined; - + res.setHeader('Access-Control-Allow-Origin', '*'); + res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS'); if (urlPath === "/" || urlPath === "") { res.end('Use gamedig queries like /server/game-protocol/port or /server/game-protocol (assumes default game port)'); } else {