mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
17 lines
414 B
JavaScript
17 lines
414 B
JavaScript
import { NextResponse } from 'next/server'
|
|
|
|
export function middleware(request) {
|
|
const response = NextResponse.next()
|
|
const nonce = 'test-nonce'
|
|
response.headers.set('x-nonce', nonce)
|
|
response.headers.set(
|
|
'Content-Security-Policy',
|
|
`default-src 'self'; script-src 'self' 'nonce-${nonce}'; style-src 'self' 'unsafe-inline'`
|
|
)
|
|
return response
|
|
}
|
|
|
|
export const config = {
|
|
matcher: '/:path*',
|
|
}
|