This commit is contained in:
Marc Seitz
2023-11-08 01:02:43 +11:00
parent bcc2824934
commit 312d3f1a8a
2 changed files with 6 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ export default async function DomainMiddleware(req: NextRequest) {
// Subdomain available, rewriting
console.log(`>>> Rewriting: ${path} to /view/domains/${host}${path}`);
url.pathname = `/view/domains/${host}${path}`;
url.host = "preview.papermark.io";
// url.host = "preview.papermark.io";
return NextResponse.rewrite(url, PAPERMARK_HEADERS);
} else {
// redirect plain custom domain to papermark.io, eventually to it's own landing page

View File

@@ -23,7 +23,11 @@ export default async function middleware(req: NextRequest, ev: NextFetchEvent) {
if (
process.env.NODE_ENV !== "development" &&
!(host?.includes("papermark.io") || host?.endsWith(".vercel.app"))
!(
host?.includes("papermark.io") ||
host?.includes("preview.papermark.io") ||
host?.endsWith(".vercel.app")
)
) {
return DomainMiddleware(req);
}