Skip to content

How do I configure CSP? #241

Answered by yzx9
jiazengp asked this question in Q&A
Discussion options

You must be logged in to vote

It’s easy to set it up yourself in user config, follow the config in the official document:

https://github.com/vuepress/vuepress-next/blob/ca22d4fe7ade66571f34dc80343f4ec57483b44a/docs/.vuepress/config.ts#L8-L51

We can config like this:

export default defineUserConfig<DefaultThemeOptions>({ 
   head: [ 
     [ 
       'meta', 
       { 
         "http-equiv": 'Content-Security-Policy', 
         content: "default-src 'self'; img-src https://*; child-src 'none';", 
       }, 
     ], 
  ]
  ...otherConfig
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jiazengp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants