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.

edited rate limit

Steven Tey1229b89fb72c
diff --git a/pages/api/edge/metatags.ts b/pages/api/edge/metatags.ts
index b9dedbf450..32591eea25 100644
--- a/pages/api/edge/metatags.ts
+++ b/pages/api/edge/metatags.ts
@@ -6,13 +6,6 @@ import { getDomainWithoutWWW, isValidUrl } from "@/lib/utils";
import sanitize from "ultrahtml/transformers/sanitize";
import { ratelimit } from "@/lib/upstash";
-const ALLOWLIST = new Set([
- "dub.sh",
- "app.dub.sh",
- "localhost:3000",
- "app.localhost:3000",
-]);
-
export const config = {
runtime: "experimental-edge",
};
@@ -23,13 +16,11 @@ export default async function handler(req: NextRequest, ev: NextFetchEvent) {
if (!isValidUrl(url)) {
return new Response("Invalid URL", { status: 400 });
}
- const hostname = req.headers.get("host");
- if (!ALLOWLIST.has(hostname)) {
- const { success } = await ratelimit.limit("metatags");
- if (!success) {
- return new Response("Don't DDoS me pls 🥺", { status: 429 });
- }
+ const { success } = await ratelimit.limit("metatags");
+ if (!success) {
+ return new Response("Don't DDoS me pls 🥺", { status: 429 });
}
+
const metatags = await getMetaTags(url, ev);
return new Response(JSON.stringify(metatags), { status: 200 });
} else {