The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
no need to find domain if linkData is valid
Steven Tey939505a013c6
diff --git a/apps/web/lib/middleware/link.ts b/apps/web/lib/middleware/link.tsindex 62575f46ea..fe16d4d635 100644--- a/apps/web/lib/middleware/link.ts+++ b/apps/web/lib/middleware/link.ts@@ -80,22 +80,27 @@ export default async function LinkMiddleware(}}- // check if domain has notFoundUrl configured- const domainData = await getDomainViaEdge(domain);- if (domainData?.notFoundUrl) {- return NextResponse.redirect(domainData.notFoundUrl, {- headers: {- ...DUB_HEADERS,- "X-Robots-Tag": "googlebot: noindex",- // pass the Referer value to the not found URL- Referer: req.url,- },- status: 302,- });- } else {- return NextResponse.rewrite(new URL(`/${domain}/not-found`, req.url), {- headers: DUB_HEADERS,- });+ if (!linkData) {+ // check if domain has notFoundUrl configured+ const domainData = await getDomainViaEdge(domain);+ if (domainData?.notFoundUrl) {+ return NextResponse.redirect(domainData.notFoundUrl, {+ headers: {+ ...DUB_HEADERS,+ "X-Robots-Tag": "googlebot: noindex",+ // pass the Referer value to the not found URL+ Referer: req.url,+ },+ status: 302,+ });+ } else {+ return NextResponse.rewrite(+ new URL(`/${domain}/not-found`, req.url),+ {+ headers: DUB_HEADERS,+ },+ );+ }}}