From 16d57801107d77dcd997af2cc4e4b8045d24fb84 Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Tue, 12 Apr 2022 16:54:02 -0700 Subject: [PATCH] client: redirect /private/ and /protected/ links to /post to handle backwards compat --- client/pages/_middleware.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/pages/_middleware.tsx b/client/pages/_middleware.tsx index 47019f6e..e4904467 100644 --- a/client/pages/_middleware.tsx +++ b/client/pages/_middleware.tsx @@ -49,6 +49,11 @@ export function middleware(req: NextRequest, event: NextFetchEvent) { return NextResponse.redirect(getURL("signin")) } } + + if (pathname.includes("/protected/") || pathname.includes("/private/")) { + const urlWithoutVisibility = pathname.replace("/protected/", "/").replace("/private/", "/").substring(1) + return NextResponse.redirect(getURL(urlWithoutVisibility)) + } } return NextResponse.next()