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.

wip

Kiran K48df932aabc8
diff --git a/apps/web/lib/analytics/verify-analytics-allowed-hostnames.ts b/apps/web/lib/analytics/verify-analytics-allowed-hostnames.ts
index ec3ee8bac8..ea1b2fc71e 100644
--- a/apps/web/lib/analytics/verify-analytics-allowed-hostnames.ts
+++ b/apps/web/lib/analytics/verify-analytics-allowed-hostnames.ts
@@ -5,13 +5,19 @@ export const verifyAnalyticsAllowedHostnames = ({
allowedHostnames: string[];
req: Request;
}) => {
- if (allowedHostnames && allowedHostnames.length > 0) {
- const source = req.headers.get("referer") || req.headers.get("origin");
- const sourceUrl = source ? new URL(source) : null;
- const hostname = sourceUrl?.hostname.replace(/^www\./, "");
-
- return hostname && allowedHostnames.includes(hostname);
+ // If no allowed hostnames are set, allow the request
+ if (!allowedHostnames || allowedHostnames.length === 0) {
+ return true;
}
+ const source = req.headers.get("referer") || req.headers.get("origin");
+ const sourceUrl = source ? new URL(source) : null;
+ const hostname = sourceUrl?.hostname;
+
+ console.log("allowedHostnames", allowedHostnames);
+ console.log("hostname", hostname);
+
return true;
+
+ // return hostname && allowedHostnames.includes(hostname);
};