Skip to content

Commit

Permalink
Add CORS headers
Browse files Browse the repository at this point in the history
  • Loading branch information
bl3rune committed May 6, 2024
1 parent c89b477 commit cae88bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cae88bd

Please sign in to comment.