From ae3d5813cf92f4f53e718671fd0e3031826225e4 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Tue, 25 Jun 2024 18:31:57 -1000 Subject: [PATCH] fix(api): :bug: Fix frontend proxy breaking when host is different than base_url --- index.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/index.ts b/index.ts index 09b4d756..1961c2ea 100644 --- a/index.ts +++ b/index.ts @@ -86,11 +86,10 @@ app.all("*", async (context) => { } } - const baseUrlWithHttp = config.http.base_url.replace("https://", "http://"); - - const replacedUrl = context.req.url - .replace(config.http.base_url, config.frontend.url) - .replace(baseUrlWithHttp, config.frontend.url); + const replacedUrl = new URL( + new URL(context.req.url).pathname, + config.frontend.url, + ).toString(); await dualLogger.log( LogLevel.Debug,