From 1821bb881add6b36fd36e1567de0a861235b285a Mon Sep 17 00:00:00 2001 From: Fredrik Strand Oseberg Date: Fri, 26 Aug 2022 11:44:12 +0200 Subject: [PATCH] fix: proxy api check (#1965) * fix: proxy api check * fix: add await * fix: revert async setup for prehook * fix: stricter endpoint checks --- src/lib/middleware/api-token-middleware.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/middleware/api-token-middleware.ts b/src/lib/middleware/api-token-middleware.ts index 0323b241d3..a3267647c7 100644 --- a/src/lib/middleware/api-token-middleware.ts +++ b/src/lib/middleware/api-token-middleware.ts @@ -7,7 +7,18 @@ const isClientApi = ({ path }) => { }; const isProxyApi = ({ path }) => { - return path && path.startsWith('/api/frontend'); + if (!path) { + return; + } + + // Handle all our current proxy paths which will redirect to the new + // embedded proxy endpoint + return ( + path.startsWith('/api/default/proxy') || + path.startsWith('/api/development/proxy') || + path.startsWith('/api/production/proxy') || + path.startsWith('/api/frontend') + ); }; export const TOKEN_TYPE_ERROR_MESSAGE =