supabase
Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...
migrating-middleware-to-proxy
Teach middleware.ts to proxy.ts migration in Next.js 16. Use when migrating middleware, encountering middleware errors, or implementing request proxying.
Full skill instructions
Next.js 16 renames middleware.ts to proxy.ts and the middleware export to proxy. This is a breaking change with security implications (CVE-2025-29927).
CVE-2025-29927: Middleware-based authentication is fundamentally broken in Next.js. Middleware cannot reliably protect routes because:
The rename to "proxy" clarifies that this API is for request/response manipulation, not security.
# Old location
src/middleware.ts
# New location
src/proxy.ts
Before (Next.js 15):
export function middleware(request: NextRequest) {
return NextResponse.next();
}
export const config = {
matcher: ['/api/:path*', '/dashboard/:path*'],
};
After (Next.js 16):
export function proxy(request: NextRequest) {
return NextResponse.next();
}
export const config = {
matcher: ['/api/:path*', '/dashboard/:path*'],
};
If using next.config.js or next.config.ts:
const nextConfig = {
experimental: {
},
};
No configuration changes needed for proxy. The framework detects proxy.ts automatically.
If you were using middleware for authentication, you must migrate to route-level protection.
export function middleware(request: NextRequest) {
const token = request.cookies.get('auth-token');
if (!token) {
return NextResponse.redirect(new URL('/login', request.url));
}
return NextResponse.next();
}
export const config = {
matcher: ['/dashboard/:path*'],
};
proxy.ts:
export function proxy(request: NextRequest) {
const response = NextResponse.next();
response.headers.set('x-custom-header', 'value');
return response;
}
app/dashboard/layout.tsx:
import { redirect } from 'next/navigation';
import { verifySession } from '@/lib/auth';
export default async function DashboardLayout({
children,
}: {
children: React.ReactNode;
}) {
const session = await verifySession();
if (!session) {
redirect('/login');
}
return <>{children}</>;
}
Key differences:
Use proxy.ts for:
Request/response header manipulation
export function proxy(request: NextRequest) {
const response = NextResponse.next();
response.headers.set('x-frame-options', 'DENY');
return response;
}
Request logging/monitoring
export function proxy(request: NextRequest) {
console.log(`${request.method} ${request.url}`);
return NextResponse.next();
}
URL rewriting
export function proxy(request: NextRequest) {
if (request.nextUrl.pathname === '/old-path') {
return NextResponse.rewrite(new URL('/new-path', request.url));
}
return NextResponse.next();
}
Geolocation routing
export function proxy(request: NextRequest) {
const country = request.geo?.country;
if (country === 'US') {
return NextResponse.rewrite(new URL('/us', request.url));
}
return NextResponse.next();
}
middleware.ts to proxy.tsmiddleware export to proxyError: "middleware is not exported"
You forgot to rename the export from middleware to proxy.
Error: "proxy is not a function"
Ensure you're exporting a function named proxy, not a default export.
Error: "Cannot access database in proxy"
Proxy runs at the edge runtime. Move database access to route handlers or Server Components.
Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...
Comprehensive guides and best practices for Neon Serverless Postgres, covering setup, connection methods, authentication, and platform APIs.
Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.
A skill to evaluate how secure Firestore security rules are. Use this when Firestore security rules are updated to ensure that the generated rules are extremely secure and robust.
Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.
Complete Better Auth server and client setup with database adapters, session management, plugins, and security configuration.
Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".
Complete Cloudflare platform integration with decision trees for compute, storage, AI, networking, security, and infrastructure-as-code.
Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.
Send, read, and manage Gmail messages, drafts, labels, and account settings.
Comprehensive website auditing across 230+ rules in 21 categories including SEO, performance, security, and accessibility.
Shared authentication, CLI syntax, and output formatting patterns for gws Google Workspace commands.
Discover your celebrity doppelgänger with StarByFace!
GeoSpy: Pricing, Features, FAQs, and Alternatives for AI Teams
Detect AI-generated voices to protect against audio fraud.
Ensure Your Content's Originality with AI Plagiarism Checker
Upscale images by 400% without quality loss
Protect your social media from copyright disputes
Accurately Detect AI-Generated Content with TheChecker.AI
Chrome extension that detects and flags AI-generated content