Doceditor: fix double base path in URL for firefox
This commit is contained in:
parent
7a736f2271
commit
5558e063a6
@ -121,6 +121,9 @@ async function Page({ searchParams }: { searchParams: TSearchParams }) {
|
||||
}
|
||||
|
||||
const redirectURL = `/doceditor?${searchParams.toString()}`;
|
||||
|
||||
console.log("====", redirectURL);
|
||||
|
||||
return permanentRedirect(redirectURL);
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,24 @@ import type { NextRequest } from "next/server";
|
||||
|
||||
// This function can be marked `async` if using `await` inside
|
||||
export function middleware(request: NextRequest) {
|
||||
return NextResponse.json({ status: "healthy" }, { status: 200 });
|
||||
const host = request.headers.get("x-forwarded-host");
|
||||
const proto = request.headers.get("x-forwarded-proto");
|
||||
|
||||
const redirectUrl = `${proto}://${host}`;
|
||||
|
||||
if (request.nextUrl.pathname === "/health") {
|
||||
console.log("Get doceditor health check for portal: ", redirectUrl);
|
||||
return NextResponse.json({ status: "healthy" }, { status: 200 });
|
||||
}
|
||||
|
||||
if (request.nextUrl.pathname.includes("doceditor")) {
|
||||
return NextResponse.redirect(
|
||||
`${redirectUrl}/doceditor${request.nextUrl.search}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// See "Matching Paths" below to learn more
|
||||
export const config = {
|
||||
matcher: "/health",
|
||||
matcher: ["/health", "/doceditor"],
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user