fix(api): 🐛 Fix frontend proxy breaking when host is different than base_url

This commit is contained in:
Jesse Wierzbinski 2024-06-25 18:31:57 -10:00
parent 51cbb22eb0
commit ae3d5813cf
No known key found for this signature in database

View file

@ -86,11 +86,10 @@ app.all("*", async (context) => {
} }
} }
const baseUrlWithHttp = config.http.base_url.replace("https://", "http://"); const replacedUrl = new URL(
new URL(context.req.url).pathname,
const replacedUrl = context.req.url config.frontend.url,
.replace(config.http.base_url, config.frontend.url) ).toString();
.replace(baseUrlWithHttp, config.frontend.url);
await dualLogger.log( await dualLogger.log(
LogLevel.Debug, LogLevel.Debug,