Skip to content

Instantly share code, notes, and snippets.

@balvinder294
Created September 23, 2019 09:08
Show Gist options
  • Save balvinder294/332af9a291dee9ff7a6caeaea391a5eb to your computer and use it in GitHub Desktop.
Save balvinder294/332af9a291dee9ff7a6caeaea391a5eb to your computer and use it in GitHub Desktop.
Sample for Content Security Policy(CSP) in JHipster
/************
Content Security policy Jhipster
**********/
/* Use directives as per your requirement like image-src and default-src for defaults of all*/
// Single line CSP
.headers()
.contentSecurityPolicy("default-src 'self';")
// Multi Line CSP joined by and
.headers()
.contentSecurityPolicy("default-src 'self';")
.and()
.contentSecurityPolicy("script-src 'self' 'unsafe-eval' 'unsafe-inline' https://www.gstatic.com https://www.google.com http://www.google-analytics.com https://maps.googleapis.com https://storage.googleapis.com;")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment