Last commit on template. Moving to tech tracker

This commit is contained in:
2025-08-28 16:14:45 -05:00
parent b5a726e359
commit 57737f5a03

View File

@@ -3,11 +3,14 @@ import {
createRouteMatcher, createRouteMatcher,
nextjsMiddlewareRedirect, nextjsMiddlewareRedirect,
} from '@convex-dev/auth/nextjs/server'; } from '@convex-dev/auth/nextjs/server';
import { banSuspiciousIPs } from '@/lib/middleware/ban-suspicious-ips';
const isSignInPage = createRouteMatcher(['/signin']); const isSignInPage = createRouteMatcher(['/signin']);
const isProtectedRoute = createRouteMatcher(['/', '/server']); const isProtectedRoute = createRouteMatcher(['/', '/server']);
export default convexAuthNextjsMiddleware(async (request, { convexAuth }) => { export default convexAuthNextjsMiddleware(async (request, { convexAuth }) => {
const banResponse = banSuspiciousIPs(request);
if (banResponse) return banResponse;
if (isSignInPage(request) && (await convexAuth.isAuthenticated())) { if (isSignInPage(request) && (await convexAuth.isAuthenticated())) {
return nextjsMiddlewareRedirect(request, '/'); return nextjsMiddlewareRedirect(request, '/');
} }
@@ -19,5 +22,8 @@ export default convexAuthNextjsMiddleware(async (request, { convexAuth }) => {
export const config = { export const config = {
// The following matcher runs middleware on all routes // The following matcher runs middleware on all routes
// except static assets. // except static assets.
matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'], matcher: [
'/((?!_next/static|_next/image|favicon.ico|monitoring-tunnel|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
'/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'
],
}; };