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.

changed /_proxy to use relative URL

Steven Tey273340aa464b
diff --git a/lib/middleware/link.ts b/lib/middleware/link.ts
index 47b9c992d0..c3f1e8b2f7 100644
--- a/lib/middleware/link.ts
+++ b/lib/middleware/link.ts
@@ -33,8 +33,8 @@ export default async function LinkMiddleware(
const isBot = detectBot(req);
if (isBot && proxy) {
- // rewrite to proxy page (dub.sh/_proxy/[domain]/[key]) if it's a bot
- return NextResponse.rewrite(`https://dub.sh/_proxy/${domain}/${key}`);
+ // rewrite to proxy page (/_proxy/[domain]/[key]) if it's a bot
+ return NextResponse.rewrite(new URL(`/_proxy/${domain}/${key}`, req.url));
} else {
return NextResponse.redirect(target);
}