forked from PHASE-STELLAR/Phase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmiddleware.ts
More file actions
25 lines (20 loc) · 743 Bytes
/
Copy pathmiddleware.ts
File metadata and controls
25 lines (20 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { NextRequest, NextResponse } from "next/server"
const CSP = [
"default-src 'self'",
"script-src 'self' 'unsafe-eval' 'unsafe-inline'",
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
"font-src 'self' https://fonts.gstatic.com",
"img-src 'self' data: blob: https:",
"connect-src 'self' https://*.stellar.org https://soroban-testnet.stellar.org wss:",
"frame-ancestors 'none'",
"base-uri 'self'",
"form-action 'self'",
].join("; ")
export function middleware(request: NextRequest): NextResponse {
const response = NextResponse.next()
response.headers.set("Content-Security-Policy", CSP)
return response
}
export const config = {
matcher: "/((?!_next/static|_next/image|favicon.ico).*)",
}