Skip to content

Full Toolkit for Next-Level Domain Analysis

Remove middleware 🚮

Felix Wotschofskyf0fe2d82dcc2
diff --git a/env.ts b/env.ts
index ac85f39..afb9fc0 100644
--- a/env.ts
+++ b/env.ts
@@ -18,12 +18,6 @@ export const env = createEnv({
SITE_URL: z.string().url().optional(),
INTERNAL_API_SECRET: z.string().min(1),
- ALLOWED_BOTS: z
- .string()
- .transform(safeJSONParse)
- .pipe(z.array(z.string()))
- .optional(),
-
GOOGLE_SERVICE_KEY_B64: z.string().optional(),
BIGQUERY_DATASET: z.string().optional(),
BIGQUERY_LOCATION: z.string().optional(),
diff --git a/middleware.ts b/middleware.ts
deleted file mode 100644
index 93ac758..0000000
--- a/middleware.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { type NextRequest, NextResponse } from 'next/server';
-
-import { env } from '@/env';
-import { isUserBot } from '@/lib/api';
-
-export const middleware = async (request: NextRequest) => {
- if (env.ALLOWED_BOTS) {
- const { isBot, userAgent } = isUserBot(request.headers);
- if (isBot) {
- const isAllowedBot =
- !!userAgent &&
- env.ALLOWED_BOTS.some((name) => userAgent.toLowerCase().includes(name));
-
- if (!isAllowedBot) {
- return new Response('Forbidden', { status: 403 });
- }
- }
- }
-
- return NextResponse.next();
-};
-
-export const config = {
- matcher: [
- {
- source: '/lookup/:domain*',
- missing: [
- { type: 'header', key: 'next-router-prefetch' },
- { type: 'header', key: 'purpose', value: 'prefetch' },
- ],
- },
- ],
-};