Skip to content

Commit

Permalink
fix(cors): Removed custom OPTIONS preflight handler in favor of defau…
Browse files Browse the repository at this point in the history
…lt Hapi CORS handler
  • Loading branch information
andris9 committed Dec 12, 2024
1 parent 3bdb8fb commit 6427728
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions workers/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1293,25 +1293,6 @@ const init = async () => {
}
});

server.route({
method: 'OPTIONS',
path: '/v1/{any*}',
handler: async (request, reply) => {
const method = request.headers['access-control-request-method'];
const response = reply.response(Buffer.alloc(0));

if (method) {
response.header('Access-Control-Allow-Methods', method);
}

return response.code(200);
},
options: {
auth: false,
cors: CORS_CONFIG
}
});

server.route({
method: 'GET',
path: '/health',
Expand Down

0 comments on commit 6427728

Please sign in to comment.