Skip to content

Commit

Permalink
Merge pull request #387 from mtdvlpr/main
Browse files Browse the repository at this point in the history
fix(ssg): generate meta tag without html,head,body tags
  • Loading branch information
Baroshem authored Feb 26, 2024
2 parents 946d42b + b8f9f8c commit 71ffc87
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/runtime/nitro/plugins/04-cspSsgHashes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export default defineNitroPlugin((nitroApp) => {
const csp = security.headers.contentSecurityPolicy
const headerValue = generateCspRules(csp, scriptHashes, styleHashes)
// Insert CSP in the http meta tag if meta is true

if (security.ssg && security.ssg.meta) {
cheerios.head.push(cheerio.load(`<meta http-equiv="Content-Security-Policy" content="${headerValue}">`))
cheerios.head.push(cheerio.load(`<meta http-equiv="Content-Security-Policy" content="${headerValue}">`, null, false))
}
// Update rules in HTTP header
setResponseHeader(event, 'Content-Security-Policy', headerValue)
Expand Down

0 comments on commit 71ffc87

Please sign in to comment.