mirror of
https://github.com/mfts/papermark.git
synced 2025-12-20 01:03:24 +08:00
fix: wip
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user