Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

added missing matcher

Steven Teya77b82b923a4
diff --git a/middleware.ts b/middleware.ts
index f8c010a984..8b97028653 100644
--- a/middleware.ts
+++ b/middleware.ts
@@ -11,6 +11,16 @@ import { isReservedKey } from "./lib/utils";
export const config = {
matcher: [
+ // Exclude `dub.sh` marketing pages
+ {
+ source: "/",
+ missing: [
+ {
+ type: "host",
+ value: "preview.dub.sh",
+ },
+ ],
+ },
/*
* Match all paths except for:
* 1. /api/ routes
@@ -44,6 +54,7 @@ export default async function middleware(req: NextRequest, ev: NextFetchEvent) {
// for root pages (e.g. dub.sh, vercel.fyi, etc.)
if (key.length === 0) {
+ console.log("RootMiddleware", domain, req.headers.get("host"));
return RootMiddleware(req, ev);
}
diff --git a/next.config.js b/next.config.js
index 7f65b37bd1..7b3fe0a857 100644
--- a/next.config.js
+++ b/next.config.js
@@ -50,6 +50,30 @@ const nextConfig = {
},
];
},
+ async rewrites() {
+ return [
+ {
+ source: "/",
+ has: [
+ {
+ type: "host",
+ value: "preview.dub.sh",
+ },
+ ],
+ destination: "/dub.sh",
+ },
+ {
+ source: "/:path*",
+ has: [
+ {
+ type: "host",
+ value: "preview.dub.sh",
+ },
+ ],
+ destination: "/dub.sh/:path*",
+ },
+ ];
+ },
};
module.exports = withContentlayer(nextConfig);