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.

remove www. from parsed domain

Steven Teyfc5c13271652
diff --git a/lib/middleware/utils.ts b/lib/middleware/utils.ts
index 20780e1580..3748b4f35e 100644
--- a/lib/middleware/utils.ts
+++ b/lib/middleware/utils.ts
@@ -3,6 +3,7 @@ import { HOME_HOSTNAMES } from "@/lib/constants";
export const parse = (req: NextRequest) => {
let domain = req.headers.get("host");
+ domain = domain.replace("www.", ""); // remove www. from domain
if (HOME_HOSTNAMES.has(domain)) domain = "dub.sh";
const path = req.nextUrl.pathname;
const key = decodeURIComponent(path.split("/")[1]); // to handle foreign languages like Hebrew