File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { db } from "@cap/database" ;
22import { organizations } from "@cap/database/schema" ;
3- import { eq } from "drizzle-orm" ;
43import { buildEnv , serverEnv } from "@cap/env" ;
4+ import { eq } from "drizzle-orm" ;
55import { notFound } from "next/navigation" ;
66import { NextRequest , NextResponse , userAgent } from "next/server" ;
77
@@ -22,9 +22,21 @@ const mainOrigins = [
2222
2323export async function middleware ( request : NextRequest ) {
2424 const url = new URL ( request . url ) ;
25- const hostname = url . hostname ;
2625 const path = url . pathname ;
2726
27+ // Add anti-clickjacking headers for /login
28+ if ( path . startsWith ( "/login" ) ) {
29+ const response = NextResponse . next ( ) ;
30+ response . headers . set ( "X-Frame-Options" , "SAMEORIGIN" ) ;
31+ response . headers . set (
32+ "Content-Security-Policy" ,
33+ "frame-ancestors https://cap.so"
34+ ) ;
35+ return response ;
36+ }
37+
38+ const hostname = url . hostname ;
39+
2840 if ( buildEnv . NEXT_PUBLIC_IS_CAP !== "true" ) {
2941 if (
3042 ! (
You can’t perform that action at this time.
0 commit comments