Skip to content

Commit

Permalink
add x-frame-options and frame-ancestors headers to stop clickjacking …
Browse files Browse the repository at this point in the history
…(#221)
  • Loading branch information
Dominic Wong authored May 10, 2022
1 parent d44e91f commit 7fe9122
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
const ContentSecurityPolicy = `
frame-ancestors 'self';
`

const securityHeaders = [
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN'
},
{
key: 'Content-Security-Policy',
value: ContentSecurityPolicy.replace(/\s{2,}/g, ' ').trim()
},
]

module.exports = {
reactStrictMode: true,
webpack(config) {
Expand All @@ -19,4 +34,12 @@ module.exports = {
},
]
},
async headers() {
return [
{
source: '/:path*',
headers: securityHeaders,
},
]
},
}

0 comments on commit 7fe9122

Please sign in to comment.