Skip to content

Commit

Permalink
feat: Configure fallback redirect for missing handle
Browse files Browse the repository at this point in the history
  • Loading branch information
shrink committed Nov 22, 2024
1 parent a4e6128 commit 2eacbfd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,20 @@ async function handleRequest(
return log.debug("Redirected to Bluesky profile.");
}

respond(res, "", 307, { location: `http://${domain}` });
return log.debug("Redirected to naked domain.");
const utm = new URLSearchParams({
utm_source: "handles-server",
utm_medium: "http",
utm_campaign: "redirect",
utm_term: handle,
});

const noProfileDestination = `${process.env.HANDLES_FALLBACK_URL || "https://" + domain}?${utm}`;

respond(res, "", 307, { location: noProfileDestination });
return log.debug(
{ noProfileDestination },
"Redirected to no profile destination.",
);
}

export function expose(handles: FindsDecentralizedIDOfHandle) {
Expand Down

0 comments on commit 2eacbfd

Please sign in to comment.