Skip to content

Commit 11c154c

Browse files
committed
Test
1 parent 9a1ac5c commit 11c154c

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

packages/server/api/src/app/flow-template/cloud-template.controller.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ export const cloudTemplateController: FastifyPluginAsyncTypebox = async (
2626
// cloud templates are available on any origin
2727
app.addHook('onRequest', allowAllOriginsHookHandler);
2828

29+
app.options(
30+
'*',
31+
{
32+
config: {
33+
allowedPrincipals: ALL_PRINCIPAL_TYPES,
34+
skipAuth: true,
35+
// cors: false,
36+
},
37+
},
38+
(_request, reply) => {
39+
return reply.status(204).send();
40+
},
41+
);
42+
2943
app.get(
3044
'/',
3145
{

packages/server/api/src/app/helper/allow-all-origins-hook-handler.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { logger } from '@openops/server-shared';
21
import { onRequestHookHandler } from 'fastify';
32

43
export const allowAllOriginsHookHandler: onRequestHookHandler = (
@@ -20,10 +19,5 @@ export const allowAllOriginsHookHandler: onRequestHookHandler = (
2019

2120
void reply.header('Access-Control-Allow-Credentials', 'true');
2221

23-
if (request.method === 'OPTIONS') {
24-
logger.info('Returning 204 No Content for CORS preflight request.');
25-
return void reply.status(204).send();
26-
}
27-
2822
done();
2923
};

0 commit comments

Comments
 (0)