feat: support custom domain in TRUSTED_ORIGIN

This commit is contained in:
Rotimi Best
2026-05-19 09:59:56 +01:00
parent 86ebe9ef62
commit 917a71ccce
12 changed files with 189 additions and 8 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
import 'dotenv/config';
import { API_SERVER_URL, TRUSTED_ORIGINS } from '@api/constants';
import { API_SERVER_URL } from '@api/constants';
import { resolveTrustedBrowserOriginForCors } from '@api/utils/origins';
import { Hono } from '@api/utils/hono';
import { accountRouter } from '@api/routes/account';
@@ -44,7 +45,7 @@ export const app = new Hono()
.use(
'*',
cors({
origin: TRUSTED_ORIGINS,
origin: (origin) => resolveTrustedBrowserOriginForCors(origin),
allowMethods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
allowHeaders: ['Content-Type', 'Authorization', 'Cio-org-id'],
exposeHeaders: ['Content-Length', 'X-Kuma-Revision'],