diff --git a/apps/scandic-web/middlewares/redirect.ts b/apps/scandic-web/middlewares/redirect.ts index b979ac856..725f29525 100644 --- a/apps/scandic-web/middlewares/redirect.ts +++ b/apps/scandic-web/middlewares/redirect.ts @@ -1,6 +1,7 @@ import { type NextMiddleware, NextResponse } from "next/server" import { notFound } from "@/server/errors/next" +import { getPublicNextURL } from "@/server/utils" import { getCacheClient } from "@/services/dataCache" import { findLang } from "@/utils/languages" @@ -52,7 +53,7 @@ export const middleware: NextMiddleware = async (request) => { ) if (matchedRedirect) { - const newUrl = new URL(matchedRedirect, request.nextUrl) + const newUrl = new URL(matchedRedirect, getPublicNextURL(request)) headers.set("Cache-control", "public, max-age=60") return NextResponse.redirect(newUrl, { headers,