Merged in fix/redirect-public-url (pull request #1902)
fix: add getPublicNextURL for redirect url * fix(SW-2540): add getPublicNextURL for redirect url Approved-by: Michael Zetterberg
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user