Skip to content

How do I configure CSP? #241

Answered by yzx9
jiazengp asked this question in Q&A
Jun 28, 2021 · 1 comments · 4 replies
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 4 replies

Comment options

You must be logged in to vote
4 replies
@gspgsp
Comment options

@yzx9
Comment options

@gspgsp
Comment options

@Mister-Hope
Comment options

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
4 participants