From 50a201d6dc2f36128c6eb28a14508e3235ccb746 Mon Sep 17 00:00:00 2001 From: Benny Samir Hierl Date: Sat, 5 Feb 2022 07:55:36 +0100 Subject: [PATCH] CORS header rule adjusted Signed-off-by: Benny Samir Hierl --- src/api/config/initApp.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/config/initApp.ts b/src/api/config/initApp.ts index eb89892..4eb83f2 100644 --- a/src/api/config/initApp.ts +++ b/src/api/config/initApp.ts @@ -16,7 +16,10 @@ export default async (opts: FastifyContextConfig = {}) => { }) await app.register(cors, { - origin: true, + origin: + process.env.NODE_ENV === 'development' + ? /https?:\/\/localhost(:\d+)?/ + : false, }) await app.register(compress)