Skip to content

Commit 1cdd0d6

Browse files
committed
chore: add csp header
Adds a CSP header to database.dev
1 parent ec97bd8 commit 1cdd0d6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

website/next.config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
/** @type {import('next').NextConfig} */
2+
3+
const cspHeader = `
4+
default-src 'self' https://api.database.dev/;
5+
style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com/ https://fonts.google.com/;
6+
img-src 'self' data: https://api.database.dev/storage/;
7+
object-src 'none';
8+
base-uri 'none';
9+
frame-ancestors 'none';
10+
`
11+
212
const nextConfig = {
313
reactStrictMode: true,
14+
async headers() {
15+
return [
16+
{
17+
source: '/(.*)',
18+
headers: [
19+
{
20+
key: 'Content-Security-Policy',
21+
value: cspHeader.replace(/\n/g, ''),
22+
},
23+
{
24+
key: 'X-Frame-Options',
25+
value: 'SAMEORIGIN'
26+
}
27+
],
28+
},
29+
]
30+
},
431
}
532

633
module.exports = nextConfig

0 commit comments

Comments
 (0)