From b341018b1ddbdfcf721ec573311331d36c4f19b5 Mon Sep 17 00:00:00 2001 From: Fredrik Strand Oseberg Date: Tue, 11 Oct 2022 09:20:29 +0200 Subject: [PATCH] fix: CORS options path (#2165) * fix: path * fix: path typo --- src/lib/app.ts | 2 +- src/lib/middleware/api-token-middleware.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/app.ts b/src/lib/app.ts index 5458519d3e..879ddc0688 100644 --- a/src/lib/app.ts +++ b/src/lib/app.ts @@ -75,7 +75,7 @@ export default async function getApp( // Preflight requests should not have Authorization headers, // so this must be handled before the API token middleware. app.options( - '/api/frontend*', + `${baseUriPath}/api/frontend*`, conditionalMiddleware( () => config.flagResolver.isEnabled('embedProxy'), corsOriginMiddleware(services), diff --git a/src/lib/middleware/api-token-middleware.ts b/src/lib/middleware/api-token-middleware.ts index 9b000019c4..0fd689f98e 100644 --- a/src/lib/middleware/api-token-middleware.ts +++ b/src/lib/middleware/api-token-middleware.ts @@ -15,7 +15,7 @@ const isProxyApi = ({ path }) => { // Handle all our current proxy paths which will redirect to the new // embedded proxy endpoint return ( - path.startsWith('/api/default/proxy') || + path.startsWith('/api/proxy') || path.startsWith('/api/development/proxy') || path.startsWith('/api/production/proxy') || path.startsWith('/api/frontend')