sveltekit-content-security-policy Svelte Themes

Sveltekit Content Security Policy

SvelteKit Content Security Policy: how you can add CSP to reduce your Svelte site's cross-site scripting (XSS) attack surface.

Rodney Lab sveltekit-content-security-policy Github banner

Rodney Lab logo

SvelteKit Content Security Policy

sveltekit-content-security-policy

How you can generate Content Security Policy HTTP Headers for your static SvelteKit site deployed to Netlify or Cloudflare Pages. The code accompanies the post on SvelteKit content security policy. If you have any questions, please drop a comment at the bottom of that page.

Building and previewing the site

If you're seeing this, you've probably already done this step. Congrats!

git clone https://github.com/rodneylab/sveltekit-content-security-policy.git
cd sveltekit-content-security-policy
pnpm install # or npm install
pnpm dev

Building

pnpm build

You can preview the built app with pnpm run preview, regardless of whether you installed an adapter. This should not be used to serve your app in production.

Feel free to jump into the Rodney Lab matrix chat room.

Top categories

Loading Svelte Themes