From e97a911fbe790023fad109b2e1c00bf6be96924e Mon Sep 17 00:00:00 2001 From: Tine Date: Sun, 13 Oct 2024 18:05:07 +0200 Subject: [PATCH] fix(cors): origin on all subdomains --- server/server.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/server.ts b/server/server.ts index 9532004..4bbffb8 100644 --- a/server/server.ts +++ b/server/server.ts @@ -21,7 +21,12 @@ app.use( ); // Allow CORS for tjo.space -app.use(cors({ origin: "https://tjo.space" })); +app.use( + cors({ + origin: (origin: string) => + origin.endsWith(".tjo.space") ? origin : "https://tjo.space", + }), +); // But, /.well-known requests from anywhere. app.use("/.well-known/*", cors({ origin: "*" }));