1import { NextRequest, NextResponse } from 'next/server';
2import { cookies } from 'next/headers';
5 * Debug endpoint to check cookie and environment settings
6 * Remove this in production!
8export async function GET(request: NextRequest) {
9 const cookieStore = await cookies();
10 const allCookies = cookieStore.getAll();
12 const sessionCookie = cookieStore.get('fieldpine-session');
14 return NextResponse.json({
16 NODE_ENV: process.env.NODE_ENV,
17 hasJwtSecret: !!process.env.JWT_SECRET,
21 protocol: request.url.split(':')[0],
23 'x-forwarded-proto': request.headers.get('x-forwarded-proto'),
24 'x-forwarded-for': request.headers.get('x-forwarded-for'),
25 'host': request.headers.get('host'),
26 'user-agent': request.headers.get('user-agent')?.substring(0, 50),
30 count: allCookies.length,
31 names: allCookies.map(c => c.name),
32 hasSession: !!sessionCookie,
33 sessionCookieSize: sessionCookie?.value?.length || 0,
35 timestamp: new Date().toISOString(),